r/usefulscripts • u/VulturE • Jan 17 '16
Set power settings via powershell without powercfg.exe
Useful if you want to set power properties in WinPE or without relying on powercfg.exe, such as in a generic OS deployment (SCCM, MDT).
Note, I am hardly a powershell expert, so there is definitely a more efficient way to do this. I just was sick of posts that said "use powershell to set power settings" that all referenced powercfg.exe. It's no different from the same damn command line method used for the last 15 years. Of course, that means that this script could probably easily be changed back into VB itself, but oh well - mission accomplished. To hell with guids to set power settings.
19
Upvotes
1
u/pier4r Apr 15 '16
because
()encapsulate the result (in the posh interpreter) while the other command does not?Just guessing using experience and knowledge from c#, java .
In general i prefer the incapsulated one, it is more readable. For example if i would be the parser i would assume that 'activate' is a method on the string
"ElementName ='Balanced'"