In the –Wait parameter 3 main checks are validated − PowerShell, WMI, and WINRM connectivity. So whenever you specify the –Wait parameter, you have to wait until all three checks pass, however, if any of the checks fail then script freezes and can not further execute. If you know which specific check you want to perform then you can specify that value with the –For parameter as shown below.
Here, for the example, we will run a single WMI check for the remote server.
Restart-Computer Test1-Win2k12 -Wait -For Wmi -Force
-For parameter must be used with –Wait parameter. Here, again if something goes wrong while validation, it may take longer and longer time for the validation to pass or fail. To prevent the deadlock situation, you can use the -Timeout parameter.