Unfortunately there is no group policy or command line command that can do this command.
If your concern is that the computer is running and consuming power, you can use the power settings to hibernate after a certain time in minutes. However, if you only want the computer to hibernate one time for the update, you'll have to manually turn off the automatic hibernate again. To do this:
Access power settings. You can do this by pressing win + r
then typing either powercfg.cpl
or control.exe /name Microsoft.PowerOptions
. If you have a laptop, then you can just right click the battery icon and click on power options.
Then Change Plan Settings
> Change advanced power settings
then maxmize the Sleep
list item, then the nested Hibernate
list item. Modify the time in minutes before hibernation.
If you feel a little fancier, you can also schedule a one time task:
Press win + r
then type Taskschd.msc
.
Create task
Add a new trigger at startup
Add a new action program/script: shutdown.exe
with arguments -s -f -t 60
Go to settings tab, check the "If the task is not scheduled to run again, delete it after:" and set the combo-box to Immediately
so the task goes away after it finishes.
Note: I set the force shutdown time window to be one minute. This is just in case something goes wrong, if it were set to 0 your computer has the potential of shutting down as soon as you startup computer, which would be a problem in of itself. If this does happen for some reason, login quickly, open a cmd or powershell and type in shutdown.exe /a
which will abort any pending shutdown command.
An additional note on hibernating/sleep: only one or the other can be active at one time. You've probably noticed, but you have only the sleep option or the hibernate option when you click the power button in start menu. If you currently have the sleep option on and you want hibernate, open an elevated powershell or cmd (press win + x
or right click start button
) and then type powercfg /h on
to turn on hibernation, and powercfg /h off
to turn on sleep/hybrid mode.