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 to reboot, 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: