PowerShell Logo Small

Restart-Computer



This is the built-in help made by Microsoft for the command 'Restart-Computer', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Restarts ("reboots") the operating system on local and remote computers.

SYNTAX


Restart-Computer [[-ComputerName] [<String[]>]] [[-Credential] [<PSCredential>]] [-DcomAuthentication {Default | None | Connect | Call | Packet | PacketIntegrity |
PacketPrivacy | Unchanged}] [-Delay [<Int16>]] [-For {PowerShell | WinRM | Wmi}] [-Force] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}]
[-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Protocol {DCOM | WSMan}] [-Timeout
[<Int32>]] [-Wait] [-WsmanAuthentication {Default | Basic | Negotiate | CredSSP | Digest | Kerberos}] [-Confirm] [-WhatIf] [<CommonParameters>]
Restart-Computer [[-ComputerName] [<String[]>]] [[-Credential] [<PSCredential>]] [-AsJob] [-DcomAuthentication {Default | None | Connect | Call | Packet | PacketIntegrity |
PacketPrivacy | Unchanged}] [-Force] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-InformationAction {SilentlyContinue | Stop | Continue |
Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-ThrottleLimit [<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Restart-Computer cmdlet restarts the operating system on the local and remote computers.


You can use the parameters of Restart-Computer to run the restart operations as a background job, to specify the authentication levels and alternate credentials, to limit
the operations that run concurrently, and to force an immediate restart.


Beginning in Windows PowerShell 3.0, you can wait for the restart to complete before running the next command, specify a waiting timeout and query interval, and wait for
particular services to be available on the restarted computer. This feature makes it practical to use Restart-Computer in scripts and functions. You can also use the WSMan
protocol to restart the computer, in case DCOM calls are blocked, such as by an enterprise firewall.


This cmdlet requires Windows PowerShell remoting only when you use the AsJob parameter in a command.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=293905
Add-Computer
Checkpoint-Computer
Rename-Computer
Remove-Computer
Restore-Computer
Stop-Computer
Test-Connection

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>Restart-Computer



This command restarts the local computer.






-------------------------- EXAMPLE 2 --------------------------

PS C:\>Restart-Computer -ComputerName Server01, Server02, localhost



This command restarts two remote computers, Server01 and Server02, and the local computer, identified as "localhost".






-------------------------- EXAMPLE 3 --------------------------

The first command uses the AsJob parameter to run the command as a background job. The command saves the resulting job object in the $j variable.
PS C:\>$j = Restart-Computer -ComputerName Server01, Server02 -AsJob

The second command uses a pipeline operator to send the job object in $j to the Receive-Job cmdlet, which gets the job results. The command saves the results in the $Results
variable.
PS C:\>$Results = $j | Receive-Job

The third command displays the result saved in the $Results variable.Because the AsJob parameter creates the job on the local computer and automatically returns the results
to the local computer, you can run the Receive-Job command as a local command.
PS C:\>$Results



These commands run a Restart-Computer command as a background job on two remote computers, and then get the results.






-------------------------- EXAMPLE 4 --------------------------

PS C:\>Restart-Computer -ComputerName Server01 -Impersonation Anonymous -Authentication PacketIntegrity



This command restarts the Server01 remote computer. The command uses customized impersonation and authentication settings.






-------------------------- EXAMPLE 5 --------------------------

The first command uses the Get-Content cmdlet to get a list of computers in the domain from the Domain01.txt file. It saves the list in the $s variable.
PS C:\>$s = Get-Content Domain01.txt


The second command gets the credentials of a domain administrator and saves them in the $c variable.
PS C:\>$c = Get-Credential Domain01\Admin01

The third command restarts the computers. It uses the ComputerName parameter to submit the list of computers in the $s variable, the Force parameter to force an immediate
restart, and the Credential parameter to submit the credentials saved in the $c variable. It also uses the ThrottleLimit parameter to limit the command to 10 concurrent
connections.
PS C:\>Restart-Computer -ComputerName $s -Force -ThrottleLimit 10 -Credential $c



These commands force an immediate restart of all of the computers in Domain01.






-------------------------- EXAMPLE 6 --------------------------

PS C:\>Restart-Computer -ComputerName Server01 -Wait -For PowerShell -Timeout 300 -Delay 2



This command restarts the Server01 remote computer and then waits up to 5 minutes (300 seconds) for Windows PowerShell to be available on the restarted computer before
continuing.

The command uses the Wait, For, and Timeout parameters to specify the conditions of the wait. It uses the Delay parameter to reduce the interval between queries to the
remote computer that determine whether it is restarted.






-------------------------- EXAMPLE 7 --------------------------

PS C:\>Restart-Computer -ComputerName Server01 -Protocol WSMan -WSManAuthentication Kerberos



This command restarts the Server01 remote computer by using the WSMan protocol, instead of DCOM, which is the default. It also uses Kerberos authentication to determine
whether the current user has permission to restart the remote computer.

These settings are designed for enterprises in which DCOM-based restarts fail because DCOM is blocked, such as by a firewall.