So.. you have a few servers running some services you would like to manage by Stop or Restart..
what would you do? log in for each server ?(NO!) ,open a GUI Tool? (NO!)
you can simply use PowerShell..Get-Service Command.
you can create a txt file contains the Computers you would like to manage ..or use an Array like : $Computers = @(“Computer1″,”Computer2″,”Computer3”) instead the txt file line 1.
to Stop Service Remotely Run.
1 2 3 4 |
$Computers= get-content '<DRIVE>\Computerslist.txt' foreach ($item in $Computers) { write-host "working on $Comp" Get-Service *nameofservice* | stop-service |
To Start Service Remotley Run.
1 2 3 4 |
$Computers= get-content '<DRIVE>\Computerslist.txt' foreach ($item in $Computers) { write-host "working on $Comp" Get-Service *nameofservice* | start-service |
Or Simply to Restart the Service ..
1 2 3 4 |
$Computers= get-content '<DRIVE>\Computerslist.txt' foreach ($item in $Computers) { write-host "working on $Comp" Get-Service *nameofservice* | Restart-service |
(Visited 1,912 times, 1 visits today)