PowerShell 2.0: One Cmdlet at a Time 10 Restart-Computer

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

What can I do with it?

Restart a local or remote computer

Example:

Immediately restart the computer Server01.

Restart-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(2)

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

1000 things 1% better!