Much of my work involves runnning scripts against multiple servers. This morning for example I had to reset IIS on 48 servers:
Whilst this script works just fine, it is quite slow because it waits for each server in the list to complete the task before moving on to the next one.
foreach ($server in (Get-Content "D:\Deployment\_ServerLists\AppServers.txt")){
Invoke-Command -cn $Server -ScriptBlock { iisreset.exe -Restart }
}
Is there anyway to tell powershell to invoke-command to each server concurrently but still writing output to transcripts (I tried running each asjob, but then I lost the output of what it was doing).
cheers for any tips!.
String :-)