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
Stop-Computer
R
I tried reducing this down to a one-liner but was getting an error. Here's my solution:
[Void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [System.Windows.Forms.Application]::SetSuspendState("Hibernate", $false, $false);