Stop (shut down) local and remote computers using WMI.
Syntax Stop-Computer [[-ComputerName] string] [[-Credential] PSCredential] [-Authentication AuthenticationLevel] [-Impersonation ImpersonationLevel] [-AsJob] [-Force] [-ThrottleLimit int] [-Confirm] [-WhatIf] [CommonParameters] Key -Authentication AuthenticationLevel The authentication level that is used for the WMI connection. Valid values: Default Windows Authentication. None No COM authentication. Connect Connect-level COM authentication. Call Call-level COM authentication. Packet Packet-level COM authentication. PacketIntegrity Packet Integrity-level COM authentication. PacketPrivacy Packet Privacy-level COM authentication. Unchanged The authentication level is the same as the previous command. -Impersonation ImpersonationLevel The impersonation level to use when calling WMI. Valid values: Default Default impersonation. Anonymous Hides the identity of the caller. Identify Allows objects to query the credentials of the caller. Impersonate Allows objects to use the credentials of the caller. -ComputerName string Stop the specified computers. The default is the local computer. Type the NETBIOS name, IP address, or fully qualified domain name of one or more computers in a comma-separated list. To specify the local computer, type the computername or "localhost". This parameter does not rely on PowerShell remoting. -Credential A user account that has permission to perform this action. The default is the current user. -Force Force an immediate shut down of the computers. -ThrottleLimit int The maximum number of concurrent connections that can be established to run this command. If this parameter is NULL or 0, the default value, 32, will be used. The throttle limit applies only to the current command, not to the session or to the computer. -whatIf Describe the command without actually executing it. -confirm Prompt for confirmation before executing the command. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.
Shutdown the local computer:
PS C:\> stop-computer
Stop two remote computers, Server64 and Server65, and the local computer:
PS C:\> stop-computer -computername Server64, Server65, localhost
Run a Stop-Computer command as a background job on two remote computers:
PS C:\> $j = stop-computer -computername Server64, Server65 -asjob
PS C:\> $results = $j | receive-job
PS C:\> $results
Run Stop-Computer against a list of computers:
C:\PS> $machines = get-content servers.txt
C:\PS> $creds = get-credential domain64\admin64
C:\PS> stop-computer -computername $machines -force -throttlelimit 10 -credential $creds
“Neither fire nor wind, birth nor death can erase our good deeds” ~ Buddha
Related PowerShell Cmdlets:
Restart-Computer - Restart the operating system on a computer.
Checkpoint-Computer - Create a system restore point.