I want to modify this script to limit the number of jobs that can run simultaneously, as well as how long the script can run for.
Powershell
$fbConn=Import-Csv-PathC:\Scripts\strings.csvForEach($sitein$fbConn){$cString=$site.DATABASELOCATION$siteid=$site.SITEID$backupDir="D:\DBBackups"$backupFile="Cpib_$siteid.bak"Start-Job-Name$siteid-FilePathC:\Scripts\gbak.ps1-ArgumentList$cString,$siteid,$backupDir,$backupFile}Get-Job|Wait-JobHere's how I think it would work, but need to translate it into real powershell syntax:
Text
$MaxJobs = 4 $MaxHours = 6 Count number of hours since start of script Count number of currently running jobs While number of running jobs = $MaxJobs { Wait until number of running jobs < $MaxJobs } If number of hours >= $MaxHours { Quit starting new jobs Stop script after last job completes } else { keep starting new...< $MaxJobs } If number of hours >