Restart-Computer -ComputerName $Names -Credential $Creds -Force -ThrottleLimit 10 $Names = Get-Content -Path C:\Domain01.txt Immediate restart and the ThrottleLimit parameter limits the number of concurrent connections. TheĬomputer names from the text file are stored in a variable. ![]() This example forces an immediate restart of the computers listed in the Domain01.txt file. Example 5: Force restart of computers listed in a text file TheĭcomAuthentication parameter specifies PacketIntegrity as the connection's authentication level. Impersonation parameter specifies Anonymous to hide the requester's identity. Restart-Computer uses the ComputerName parameter to specify Server01. Restart-Computer -ComputerName Server01 -Impersonation Anonymous -DcomAuthentication PacketIntegrity Restart-Computer restarts a remote computer with customized impersonation and authentication ![]() $Job is sent down the pipeline to the Receive-Job cmdlet that gets the results. TheĪsJob parameter runs the command as a background job. Restart-Computer uses the ComputerName parameter to specify Server01 and Server02. $Job = Restart-Computer -ComputerName "Server01", "Server02" -AsJob Local computer, you can run Receive-Job as a local command. These commands run a Restart-Computer command as a background job on two remote computers, andīecause AsJob creates the job on the local computer and automatically returns the results to the Restart-Computer -ComputerName Server01, Server02, localhost Example 3: Restart computers as a background job The ComputerName parameter accepts anĪrray of computer names. Restart-Computer can restart remote and local computers. Restart-Computer Example 2: Restart multiple computers Restart-Computer restarts the local computer. Examples Example 1: Restart the local computer This cmdlet requires Windows PowerShell remoting only when you use the AsJob parameter in aĬommand. You can use the WS-Management (WSMan) protocol to restart the computer, in case DistributedĬomponent Object Model (DCOM) calls are blocked, such as by an enterprise firewall. This feature makes it practical to use Restart-Computer in Specify a waiting time-out and query interval, and wait for particular services to beĪvailable on the restarted computer. ![]() Starting in Windows PowerShell 3.0, you can wait for the restart to complete before you run the nextĬommand. The same time, and to force an immediate restart. To specify the authentication levels and alternate credentials, to limit the operations that run at You can use the parameters of Restart-Computer to run the restart operations as a background job, The Restart-Computer cmdlet restarts the operating system on the local and remote computers. Restarts the operating system on local and remote computers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |