JP Davy

JP Davy

How To Restart A Windows Server Remotely Via PowerShell

by JP Davy - June 8th, 2017

PowerShell brings a lot of neat tricks to the Windows OS (most of which Mac and Linux have always had, but I digress). If you manage several Windows servers like I do, you've probably found yourself unable to connect with Remote Desktop to a server that has frozen up. PowerShell to the rescue!

You come into the office early in the morning, before anybody else has arrived - even those east coast guys at the manufacturing facility. Suddenly you notice the east coast SQL server isn't syncing data with your headquarters as it should. Your RDP attempts fail as you try, and try again to log in to see what's wrong. What do you do?

Well, log into either your Windows PC, or RDP into your Active Directory server, and open up a PowerShell session.

  • At the command prompt, type:
    restart-computer "server01" -credential "myCompanyDomain\AdministratorCreds"

That's it! That should get the server to restart. You can even have multiple servers restart by listing the servers separated by commas: restart-computer "server01","server02","server03"