PowerShell 2.0: One Cmdlet at a Time 76 Stop-Computer

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Stop-Computer cmdlet.

What can I do with it?

Shutdown a local or remote computer

Example:

Immediately shutdown the computer Server01.

Stop-Computer -ComputerName Server01 -Force

How could I have done this in PowerShell 1.0?

You could have used the Win32_OperatingSystem WMI Class and the Win32Shutdown method.

(Get-WmiObject -Class Win32_OperatingSystem -ComputerName Server01).Win32Shutdown(5)

Alternatively the Systinternals tool PSShutdown could be used to shutdown a local or remote computer.

1000 things 1% better!