Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

You may use the following commands in a PowerShell prompt:

Add-Type -Assembly System.Windows.Forms
[System.Windows.Forms.Application]::SetSuspendState("Suspend", $false, $true)
share|improve this answer

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

Rundll32.exe Powrprof.dll,SetSuspendState
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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