Sometimes in the enterprise, you may need to make sure your laptops don’t enter sleep while plugged in. However, you’d still like them to sleep if they’re not plugged in. This comes in handy if you run encryption AFTER booting for the first time and/or run your patches at night, either way. You can use MDT 2012 to disable power while on AC only.
File this one under “cool command line powerconfig trick that should be done in AD, but we’re doing it live.”
If you need to disable sleep while plugged in via the task sequence, create a new step in your task sequence, run this via command line.
powercfg.exe -change -standby-timeout-ac 0
This sets the task sequence to never allow the system to sleep while plugged in. Note, this step needs to run AFTER applying the GPO packs in order to work.
This sets sleep to never while plugged in from your MDT 2012 task sequence.