Scripting Jobs  

Home
Up
What's New
DTS
SQL-DMO
SQL-NS
XP's
Misc. Tools
Events
FAQ
Links
About...

 

ScriptJobs

version: 1.0.0.0

last updated: 17 February 2002

ScriptJobs is a VBScript that uses SQL-DMO to script out jobs. It can enumerate jobs using the -L parameter, which will create an output like:

ScriptJobs -S (local)\dev -E -L
JobName: SET
JobID  : 7D22A03D3A6D3B47B3DA103C2CE757A4

JobName: WhoIsInvoking
JobID  : F5BA6214FCDB3E4CAE041243C4FEAF7D

JobName: Tokens VBScript
JobID  : FE553810693A694B89E1535C6245B8AC

JobName: Tokens T-SQL
JobID  : 316E85124D402F4C94946B59A9B3F417

ScriptJobs can script out all jobs or a single job at the time, identified by name or ID. The later is useful when you have multiple jobs with the same name (which is allowed since the primary key for jobs are ID's). The result can be send to the console (STDOUT) or to file. When script all jobs the results are send to a directory, where each job is represented as a separate file.

Usage: ScriptJobs [-S server] [-U user name] [-P password]
                  [-E integrated security]
                  [-j jobname] [-i jobid] [-f filename]
                  [-J all jobs] [-F file directory]
                  [-L list jobs]

Arguments:
-S - server name
-U - user name
-P - password
-E - integrated security
-j - job name
-i - job ID
-f - file name
-J - script all jobs
-F - script directory
-L - list jobs
-? - display command usage

Examples:
ScriptJobs -S (local) -E -j "Test Job"
ScriptJobs -S (local) -E -j "Test Job" -f C:\TestJob.sql
ScriptJobs -S (local) -E -J -F C:\ScriptsDir
ScriptJobs -S (local) -E -i FE553810693A694B89E1535C6245B8AC -f C:\MyJob.sql
ScriptJobs -S (local) -E -L

Download ScriptJobs

***

Questions or problems regarding this web site should be directed to webmaster@sqldev.net.
Copyright © 1991-2003 SQLDev.Net. All rights reserved.
Last modified: 07/06/03.