Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Copy-Item using Windows PowerShell Multithreading?

$
0
0

Hello all,

I need to figure out a way to copy a 500MB .zip file to about 400 servers in parallel.
Until now, I have been using the ForEach () method. But, I'd like to use a parallel method so that I can copy 500MB to multiple servers at once, to lower the total copy time.
I have been reading that I can do this using PowerShell Jobs. What is the best way to do this?

Here is my code using ForEach:

$servers = Get-Content C:\servers.txt

ForEach ($server in $servers)
{
Copy-Item -Path C:\500MB.zip -Destination "\\$server\c$\" -Verbose
}
Any help very much appreciated.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>