Skip to content

Instantly share code, notes, and snippets.

@ktaranov
Forked from alevyinroc/Demo-RSJob.ps1
Created August 22, 2019 15:24
Show Gist options
  • Select an option

  • Save ktaranov/7f2fffeac932cccbb972fa03c0de61e7 to your computer and use it in GitHub Desktop.

Select an option

Save ktaranov/7f2fffeac932cccbb972fa03c0de61e7 to your computer and use it in GitHub Desktop.
import-module poshrsjob;
$DownloadDir = "/users/andy/Downloads/poshrsjob";
$MaxJobs = 3;
foreach ($i in 1..24) {
Start-RSJob -Throttle $MaxJobs -Batch "Demo" -argumentlist $i, $DownloadDir -ScriptBlock {
param($JobNum, $OutputDir)
$OutputFile = Join-Path -Path $OutputDir -ChildPath "RSJob$JobNum.zip";
Start-Sleep -Seconds (get-random -Minimum 1 -Maximum 15);
Invoke-WebRequest -uri "https://github.com/proxb/PoshRSJob/archive/master.zip" -OutFile $OutputFile;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment