Stop-Computer is a Windows PowerShell command that allows users to shut down or restart their computers. It is a useful tool for system administrators who need to quickly and easily shut down or restart multiple computers. In this article, we will discuss the syntax, parameters, inputs, outputs, examples, and tips for using the Stop-Computer command.

Syntax

The syntax for the Stop-Computer command is as follows:

  • Stop-Computer [-ComputerName] string[] [-Force] [-WhatIf] [-Confirm] [-Delay int32] [-Credential pscredential] [-ThrottleLimit int32] [-AsJob] [-IncludeUserName] [-IncludeDomain] [-ExcludeUserName] [-ExcludeDomain] [-AllowServiceRestart] [-Wait] [-DcomAuthentication authenticationlevel] [-Impersonation impersonationlevel] [-Authentication authenticationlevel] [-EnableAllPrivileges] [-DisableAllPrivileges] [-ShowSecurityDescriptorUI] [-Protocol protocoltype] [-Timeout int32]

Parameters

The Stop-Computer command has several parameters that can be used to customize the command. The parameters are as follows:

Parameter Description
ComputerName Specifies the name of the computer to shut down or restart. This parameter is required.
Force Forces the computer to shut down or restart without prompting the user.
WhatIf Shows what would happen if the command were executed without actually executing it.
Confirm Prompts the user to confirm the command before executing it.
Delay Specifies the number of seconds to wait before shutting down or restarting the computer.
Credential Specifies the credentials to use when connecting to the computer.
ThrottleLimit Specifies the maximum number of computers that can be shut down or restarted at the same time.
AsJob Runs the command as a background job.
IncludeUserName Specifies that the user name of the user who initiated the shutdown or restart should be included in the output.
IncludeDomain Specifies that the domain of the user who initiated the shutdown or restart should be included in the output.
ExcludeUserName Specifies that the user name of the user who initiated the shutdown or restart should not be included in the output.
ExcludeDomain Specifies that the domain of the user who initiated the shutdown or restart should not be included in the output.
AllowServiceRestart Specifies that services that are dependent on other services should be allowed to restart.
Wait Specifies that the command should wait for the computer to shut down or restart before continuing.
DcomAuthentication Specifies the authentication level to use when connecting to the computer.
Impersonation Specifies the impersonation level to use when connecting to the computer.
Authentication Specifies the authentication level to use when connecting to the computer.
EnableAllPrivileges Specifies that all privileges should be enabled when connecting to the computer.
DisableAllPrivileges Specifies that all privileges should be disabled when connecting to the computer.
ShowSecurityDescriptorUI Specifies that the security descriptor user interface should be displayed when connecting to the computer.
Protocol Specifies the protocol to use when connecting to the computer.
Timeout Specifies the maximum amount of time to wait for the computer to shut down or restart before timing out.

Inputs

The Stop-Computer command requires the following inputs:

  • ComputerName: The name of the computer to shut down or restart.
  • Force: Optional. Forces the computer to shut down or restart without prompting the user.
  • WhatIf: Optional. Shows what would happen if the command were executed without actually executing it.
  • Confirm: Optional. Prompts the user to confirm the command before executing it.
  • Delay: Optional. Specifies the number of seconds to wait before shutting down or restarting the computer.
  • Credential: Optional. Specifies the credentials to use when connecting to the computer.
  • ThrottleLimit: Optional. Specifies the maximum number of computers that can be shut down or restarted at the same time.
  • AsJob: Optional. Runs the command as a background job.
  • IncludeUserName: Optional. Specifies that the user name of the user who initiated the shutdown or restart should be included in the output.
  • IncludeDomain: Optional. Specifies that the domain of the user who initiated the shutdown or restart should be included in the output.
  • ExcludeUserName: Optional. Specifies that the user name of the user who initiated the shutdown or restart should not be included in the output.
  • ExcludeDomain: Optional. Specifies that the domain of the user who initiated the shutdown or restart should not be included in the output.
  • AllowServiceRestart: Optional. Specifies that services that are dependent on other services should be allowed to restart.
  • Wait: Optional. Specifies that the command should wait for the computer to shut down or restart before continuing.
  • DcomAuthentication: Optional. Specifies the authentication level to use when connecting to the computer.
  • Impersonation: Optional. Specifies the impersonation level to use when connecting to the computer.
  • Authentication: Optional. Specifies the authentication level to use when connecting to the computer.
  • EnableAllPrivileges: Optional. Specifies that all privileges

Leave a Reply