Restart-Computer is waiting too long

Hello.

I restart about 1000 servers every month at once with the script below.

# PSVersion 5.1.17763.2931
$Params = @{
    ComputerName = Get-Content -Path ServerList.txt
    Protocol = 'WSMan'
    WsmanAuthentication = 'Kerberos'
    Force = $true
    Wait = $true
    For = 'WinRM'
    Delay = 5
    Timeout = 600
    ErrorAction = 'SilentlyContinue'
}
Restart-Computer @Params

Even after waiting 20 minutes, the progress bar doesn’t progress any further in “Completed: 0/xxxx”.
However, the servers appear to have been restarted a few minutes ago.
Why is the progress bar not progressing and the Timeout parameter not working?

Thank you.

Try changing your erroractionpreference to Continue. See if it shows any errors, while still continuing.

deemo,
Welcome to the forum. :wave:t4:

I cannot test with 1000 servers but for 2 it just works as expected? Are you really running this command agains 1000 servers at once? Are you sure all these servers are up and running? It might be a good idea to limit the amount of servers rebooting at the same time to a smaller count. You may start 100 servers at a time and run the command for the next chunks of servers when the first servers are up again. :man_shrugging:t4:

Next month’s maintenance, I’ll limit the number of servers restarting at once to 100 and see if any errors occur. Thanks for your advise. :slightly_smiling_face:

You might also try using PowerShell Version 7.x.x … I have found remote performance to be far superior to Windows Powershell (5.1) and very robust.

Just my $.02