Wednesday, November 9, 2011

Use “PowerCfg.exe” to change “Power Scheme” of the system with the help of “PowerShell”


Hi,

In my office everyone is using Different “Power Schemes” on there  systems. it’s good but sometime it cause little problems sometime  Somebody complains about his/her desktop go to sleep mode after “10 Minutes” which they don't like , somebody says they “ want to hibernate their laptops after 15 Minutes of idle time.
Then i think that the best way to resolve the problem is to apply  same “Power Scheme” on all the laptops, And to implement  this I choose  “PowerShell”.

The Ideas is :

Write a Script in PowerShell , which check the Current “Power Scheme” and if the scheme is one which we want to use than it wont do anything and if user have some other power scheme applied then the script change it to our one. Then put this script in to “Login Script” so that it applied and check every time when users log-in in to his/her laptop.
To accomplish this task we have used Windows inbuilt command like utility “PowerCfg.exe”

You can download the Script from here : http://gallery.technet.microsoft.com/scriptcenter/Change-Windows-Power-Scheme-3b794e0b

Some Screenshots:
Lets Run the PowerCfg –L to check the available power schemes

PowerCfg-1

Ok.. Now check which “Power Scheme is Currently Active” using PowerCfg –GetActiveScheme  , currently “Maximum Battery Life” Power scheme is active , and in our script we define that default “Power Scheme” should be “ Energy Star”

PowerCfg-2

Let’s RUN the script and see if that works….After running the script it says that “Power Scheme” Successfully applied” ,

PowerCfg-3 

Let’s Verify it., run the PowerCfg –GetActiveScheme  again and see what we got,,, Bingo !!!! now our current  active scheme is “Energy Star” which means our script is running successfully

PowerCfg-4

You can download the Script from here http://gallery.technet.microsoft.com/scriptcenter/Change-Windows-Power-Scheme-3b794e0b

Thanks
Aman Dhally 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.