Sunday, 5 April 2020

STEP BY STEP PRACTICALS - POWER-SHELL - HOW TO REBOOT THE SERVERS VIA POWERSHELL (IN DOMAIN)

POWERSHELL - HOW TO REBOOT THE SERVERS VIA POWERSHELL (IN DOMAIN)


 We can reboot multiple servers from powershell at the same time. In my example, I will be rebooting 2 servers which are part of a domain from a single computer.

Please follow the below steps to perform the same:-


1)  I have created a text file name Servers.txt which has the name of all the 2 servers and as an example, I am keeping it in C drive which will be restarted.

 


2) Now I have created a variable $vmlist and will store the contents of the file Servers.txt kept on the C Drive which has the names of the Servers which will be re-started. This needs to be done from power shell.




 Note:- In my case, I am running from domain administrator account.


 3) You can check the Content of the file Servers.txt by running the below command:- 

Command:- echo $vmlist


4) Now to reboot the servers,type in the below command from one of the remote computers. In my example, I am doing it from the DC.

Command:- Restart-Computer –ComputerName $vmlist -Force -Verbose



 

The Force parameter causes an immediate restart of each computer.
The Verbose parameter tells you what has been done.



 5) Out of running the above command:-




No comments:

Post a Comment