Thursday, October 17, 2013

Powershell: Restart a Remote Machine

Option 1: Prompt user for machine name to be restarted
CLS $cname = Read-Host "Enter Machine Name or IP Address" Restart-Computer -computerName $cname -Force

 Option 2: Enter the name directly in the code. cls Restart-Computer -computerName "EnterMachineNameHere" -Force

 Option 3: Reboot multiple Machines
cls $cname ="Server01, Server02, Server03" Restart-Computer -computer $cname -force

Joe Piggee





No comments:

Post a Comment