I'd like to be able to put my laptop to sleep from the command line. According to Microsoft, the Win32_Battery WMI class has a SetPowerState method that looks like it should be able to do this, however, on several laptops I've tried, I just get different errors indicating this method is not implemented or other various failures:

-> gwmi Win32_Class
Get-WmiObject : Retrieving the COM class factory for component with CLSID {EB87E1BD-3233-11D2-AEC9-00C04FB68820} failed
 due to the following error: 80040154.
At line:1 char:5
+ gwmi <<<<  Win32_Class
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMException
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

Do any laptops implement this? Know another way to do this? Doesn't have to be WMI, anything that puts the machine in the same low power state as shutting the lid does on most laptops.

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

This command run from cmd.exe should hibernate your computer:

Rundll32.exe Powrprof.dll,SetSuspendState
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.