Use WIndows Power Shell to Script SQL Jobs from one instance to another

Open Powershell Execute Invoke-Sqlcmd Execute $output = "d:\ScheduledJobs.sql" Execute Remove-Item $output Execute Set-Location SQLSERVER:\SQL\localhost\DEFAULT\JobServer\Jobs Execute # loop through jobs appending output Lastly Execute dir | %{$_.script() + "`n`nGO`n`n" | out-file -append $output} Do the above one line at a time then take the output ScheduledJobs.sql go to the new server and open Management Studio and…

Read More