0

I wrote a script that remotely pulls patches stored on the network and puts them on the servers stored in a text.
Currently the script works perfect, but it does one server at a time. I need it to run a instance of the script for each server at the same time so that I don't have to wait for patches to transfer.
Is there a way to call several instances of the same script with a different parameter in each?

ForEach($Server in $ServerList)
{
    Get-Patches -Server $Server -Credentials $Creds -Domain $Domain 
}

Something like this, so that creds only have to be entered once for each domain.

Thanks!

  • `Foreach` will execute the script for your servers, one at a time. I guess, what you are looking for is [parallel processing in PowerShell](https://blogs.technet.microsoft.com/uktechnet/2016/06/20/parallel-processing-with-powershell/). See [here](https://stackoverflow.com/questions/43685522/running-tasks-parallel-in-powershell). – Vivek Kumar Singh May 23 '18 at 06:55
  • Possible duplicate of [Running tasks parallel in powershell](https://stackoverflow.com/questions/43685522/running-tasks-parallel-in-powershell) – BenH May 23 '18 at 12:44

0 Answers0