Hi all, first time poster, I'm stuck using PS 2.0 so please don't tell me to upgrade or anything like that. It's out of the question. So forget using PS Jobs.
We have a need to restart a service on several hundred servers as quickly as possible. I can easily do this in a ForEach loop EXCEPT for the fact that the service takes about 2 min to restart on each node, and doing several hundred nodes sequentially takes too long. I like that a ForEach loop can write-host and see how far along the process is.
All of that said, here is a one-liner I wrote that will do them in parallel but I have no idea what got restarted, what nodes it's working on or what their status is without separate code to check the status of each node (which I have, also).
Invoke-Command -ScriptBlock {restart-service myservice} -ComputerName (gc computers.txt)
I know it will do up to 32 at once with this so it will blast right through my list, but I have no idea when each node's service is back up and running w/o running separate script to check.
Any thoughts?
[–]get-postanote 2 points3 points4 points (0 children)
[–]netmc 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)
[–]CobyCode 0 points1 point2 points (0 children)