Script out Jobs in SQL Server

Do you want to script out the jobs available in SQL Server Agent ? There a many ways to skin the cat.

  • The probably easiest one is to us the built in functionality of SSMS. Simply select all the jobs (doing a STRG+A on the Object Explorer list) and choose Script.


  • Script jobs separately (this can get tedious with having hundreds of Jobs :-))


  • Use a simple SMO Application which can connect to the JobServer, query for jobs and write them down in a separate file. In addition it will create a calling .sql-Script file and a batch command which is parameterized to execute it against a new server. For geeks sake, I wrote this small Consoleapplication and attached it to this thread for your reference and further use.


If you have feedback on that or things that could be better, feel free to write me a feedback.