Search code examples
powershellpsexecpowercfg

Mass change powercfg on remote computers


I'm wondering if there is a way to modify the powercfg script to pull from a list of PC's to change the power settings on many remote computers?

This is the script i'm using now:

psexec \PC-NAME powercfg -change -hibernate-timeout-ac 0

Thanks!


Solution

  • Instead of a single machine name, PsExec can execute the command against a list of servers from a text file:

    psexec @PCs.txt powercfg -change -hibernate-timeout-ac 0
    

    assuming PCs.txt is a file in the current directory containing the name of a computer on each line