PS 5.1 Bug: Restart-Computer hangs PowerShell after completion when passing large array of ComputerNames
when I call:
Restart-Computer -ComputerName $lotsOfComputers -Force
where: $lotsOfComputers is 20-150 other computers on the LAN in our AD environment
This is the sequence of events: First, the command completes quickly, the expected computers reboot, and no errors are displayed. I can then type in the console exactly 1 new line of input and hit enter, after which the PowerShell console hangs for a long period of time (several minutes), possibly in correlation to the size of the array of computers. Once it begins hanging it does not register any new keyboard input onscreen during the hang (but it does stay queued up), and after random periods of time, several of the typed keys will show up in the console, then the hang continues, then a few more keys, then eventually they all show up, the hang has finished, and the console is usable again.
Currently occurs on Windows 10 v1709 with the built-in Windows PowerShell version (PSVersion = 5.1.16299.785 as I type this) Does not seem to be machine-specific, it's happened on any Windows 10 machine I've tried this on Windows Powershell 5.1 went RTM.
Mark Leighton commented
I see this problem too on Windows Server 2016. When using multiple PowerShell consoles, the total number of computers seems to be consistent with the number when using a single console.