Again I challenged myself to make a PowerShell script, this time I wanted to stress test a file server so I needed to start multiple file copies from one source folder to multiple destination folder on a share. To somehow simulate multiple users copying files I would also need to start the script from more than one computer.
The script will start background jobs that will copy all files and folders in a specific folder and you can configure how many jobs to run in parallel and how long it should sleep until checking to start the next job. The DestPaths variable is an array so you can add how many folder you would like or if you’d like to copy files to different computer.
An other good example would be when I run a workshop and need to copy files to all computers and don’t want to overload the server or the network this script will for certain help me with that!
Here is the script, you are more than happy to edit and build the script in your way, but it would be nice if you can share your script with us!
$SourcePath = “c:\Temp\1\*”
Foreach ($DestPath in $DestPaths)
while (($JobsRunning = ((Get-Job -State Running).Count)) -ge $ParallelJobs)
Start-Sleep -S $JobCheckSleepTime
#Create destination folder if not already exists
Write-Host “Starting job ” -NoNewline
if ((Get-Job -State Running).Count -ne 0)