Sick of Wondering if a Remote Computer is done Rebooting? PowerShell can help!

Unfortunately in Windows, we often need to reboot for various reasons, whether that be installing patches, software etc. When we do this remotely, it is a waiting and guessing game to know when your machine(s) are up back up. Fortunately, if you use PowerShell for rebooting, we can know for sure with Restart-Computer.

In this example, I want to reboot the computer “testmachine1”. In the Restart-Computer command, I use the -For parameter to indicate that I want powershell to be available remotely via WMI before returning to my prompt. I specify -timeout and -wait to wait 10 minutes for the machine to reboot and be ready again. I also use -Force to reboot even if another user is logged on.

Click the gif below to play:



5 Responses to “Sick of Wondering if a Remote Computer is done Rebooting? PowerShell can help!

  • Art Pufford
    2 years ago

    I’m pretty new to Powershell. How do you get the countdown timer under “VERBOSE: Performing the operation “Enable the Remote shutdown access rights and restart the computer.”
    on target “XXXXXXXXX”.” When I run the command, it reboots the server and then just sits there with nothing on the screen until the computer is back up. That is fine but having the counter would be nice. Thank you…..

    • Dan Franciscus
      2 years ago

      Hmm. What version of PowerShell are you using? I did not do anything special outside of running that exact command.

    • Matthew Davidson
      2 years ago

      Hi Art…this could be due to the version of powershell you are using.

  • Matthew Davidson
    2 years ago

    Really handy line of code too….it works very well when you reboot a system remotely and the remote software needs to load up before you can reconnect. Thanks for the great tip Dan!

Leave a Reply

Your email address will not be published. Required fields are marked *