Photo by Soubhagya Maharana on
  • Export Task Scheduler Jobs
  • This will export jobs on Desktop only from Root Task Jobs
New-Item -Path $home\desktop\Jobs -ItemType Directory
Get-ScheduledTask -taskpath \| foreach {
Export-ScheduledTask -TaskName $_.TaskName -TaskPath $_.TaskPath |
Out-File (Join-Path "$home\desktop\Jobs" "$($_.TaskName).xml")
  • Copy all exported xml to Folder Name Jobs on new server.
  • It will import and disable the job so that you can enable them as needed.
  • Type User and Password in the script. You can change these values later for individual jobs.
$JobsXML = get-childitem -Path $home\Desktop\Jobs\ -Recurse
foreach ($EachJobName in ${
$FilePath = (Join-path "$home\desktop\Jobs\" "$($EachJobName)")
$BuildTaskName = $EachJobName -replace ".xml"
Register-ScheduledTask -Xml (get-content $FilePath |out-string) -TaskName $BuildTaskName -User cvent\serviceaccount -Password "password"
disable-ScheduledTask $BuildTaskName
write-host $FilePath

Thanks for reading !