Monday 5 February 2018

Powershell: Restart a Windows Server

To continue the tradition of using Powershell for normal activity we would otherwise do using the Windows Graphical Interface here is a quick intro to using the command Restart-Computer to restart your server or computer.



The command available in Powershell for this task is as mentioned above Restart-Computer.


To restart a server or computer, log in and open up a Powershell Console Window. 

One of the easier ways to open up a Powershell Console Windows is by typing 

Windows button + X

 to get the Power Users menu.



Then choose Windows Powershell.

When you get the Powershell console window up and running, type:
Restart-Computer

To specify the computername to be affected by the restart, perhaps for your own peace of mind, type:
Restart-Computer -Computername <add computername>

This can also be used to restart other servers and computers that you have network access and rights to.
Note: These commands restart without prompting, make sure you are certain you want to restart.

You can also specify which account should perform the command with the -Credential switch.

Restart-Computer -Credential <domain\accountname>

For more help and syntax there is always the Get-Help command.
In this case Get-Help Restart-Computer

No comments:

Post a Comment