Restart ("reboot") the operating system on local and remote computers.

      Restart-Computer [[-ComputerName] string[]] [[-Credential] PSCredential]
         [-AsJob] [-Authentication AuthenticationLevel] [-Force]
            [-Impersonation ImpersonationLevel] [-ThrottleLimit int]
               [-Confirm] [-WhatIf] [CommonParameters]

      Run the command as a background job.

      When this parameter is used, Restart-Computer will immediately return an
      object that represents the background job.
      You can continue to work in the session while the job completes. 
      The job is created on the local computer and results from remote computers are
      automatically returned to the local computer.

      To manage the job, use the Job cmdlets.
      To get the job results, use Receive-Job.

      To use this parameter, the local and remote computers must be configured for remoting.
      On Windows Vista and later, you must open PowerShell with the "Run as administrator" option.

   -Authentication AuthenticationLevel
      The authentication level that is used for the  WMI connection.
      (Restart-Computer uses WMI.) The default value is Packet.
      Valid values are:

         Unchanged       The authentication level is the same as the previous command.
         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.

   -ComputerName string[]
       One or more remote computers. The default is the local computer.

       Type the NETBIOS name, an IP address, or a fully qualified domain name
       of a remote computer. To specify the local computer, type the computer name,
       a dot (.), or "localhost".

       This parameter does not rely on PowerShell remoting.

   -Credential PSCredential
       A user account that has permission to perform this action.
       The default is the current user.

       Type a user name, such as "User64" or "Domain64\User64", or enter a
       PSCredential object, such as one generated by Get-Credential.
       If you type a user name, you will be prompted for a password.

       Force an immediate restart of the computer(s).

   -Impersonation ImpersonationLevel
       The impersonation level to use when calling WMI. (Restart-Computer uses WMI.)
       The default value is "Impersonate".

       Valid values are:

         Default      Default impersonation.
         Delegate     Delegate impersonation.
         Anonymous    Hide the identity of the caller.
         Identify     Allow objects to query the credentials of the caller.
         Impersonate  Allow objects to use the credentials of the caller.

   -ThrottleLimit int
       The maximum number of concurrent connections that can be established to run this command.
       If this parameter is set to 0, or omitted, the default value of 32, is used.

       The throttle limit applies only to the current command, not to the session.

       Prompt for confirmation before executing the command.

       Describe what would happen if you executed the command without actually
       executing the command.

       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

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

Use the parameters of Restart-Computer to run the restart operation 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.

The -AsJob parameter will require Windows PowerShell remoting.


Restart the local computer:

PS C:> restart-computer

Restart two remote computers, and the local computer:

PS C:> restart-computer -computername Server64, Server65, localhost

Run a Restart-Computer command as a background job on two remote computers, and then get the results:

PS C:> $job = restart-computer -computername Server64, Server65 -asjob
PS C:> $results = $job | receive-job
PS C:> $results

Restart a list of computers:

PS C:> $machines = get-content E:\servers.txt
PS C:> $creds = get-credential domain64\admin64
PS C:> restart-computer -computername $machines -force -throttlelimit 10 -credential $creds

“Life is not about how fast you run, or how high you climb, but how well you bounce ~ Unknown”


Add-Computer - Add a computer to the domain
Remove-Computer - Remove the local computer from a workgroup or domain

Copyright © 1999-2017
Some rights reserved