Scripting. Powershell, VMware, Windows, Active Directory & Exchange. All that kind of stuff…..
RSS icon Email icon Home icon
  • PowerShell 2.0: One Cmdlet at a Time #76 Stop-Computer

    Posted on March 15th, 2010 Jonathan Medd No comments

    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!

    Leave a reply