Thursday, April 21, 2011

How to control server power state via powershell

Here's a great link to some powershell commands to power off your server remotely. The regular powershell command stop-computer didn't really do it for me, but these do.

Here's the command I use to shutdown bare metal UCS blads running Windows 2008 R2
 (gwmi win32_operatingsystem -ComputerName -Credential (Get-Credential Administrator)).win32shutdown(8)

The (8) at the end means power off, as opposed to just shutdown. When I try to just shutdown, it reboots and I'm back where I started.

No comments:

Post a Comment