I am interested in using Windows PowerShell to suspend or hibernate a computer. How do you achieve this?
I am already aware of the Stop-Computer
and R
Hope you find these useful.
Shutdown %windir%\System32\shutdown.exe -s
Reboot %windir%\System32\shutdown.exe -r
Logoff %windir%\System32\shutdown.exe -l
Standby %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby
Hibernate %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate
EDIT:
As pointed out in comment by @mica, the suspend (sleep) actually hibernates. Apparently this happens in windows 8 and above. To 'sleep', disable hibernation OR get an external Microsoft tool (not built-in)
"One of Microsoft's Sysinternals tool is PsShutdown using the command psshutdown -d -t 0
it will correctly sleep, not hibernate, a computer"
Source: https://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu