SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

create jobs script for 2000 2005 or 2008

By Gene Hunter,

all you need to know is that

2000 uses 'Ole Automation Procedures'

2005 uses vbscript

2008 uses powershell

had to do it this way due to complexity but someone else might be able to fix it better.

if you do not have powershell installed on 2008 sql server you can use the vbscript version also for 2008 just change the code to jump to that part.

execution is easy, note there is no file extension on the @ps1filename

exec [dbo].[DR_Generate_Script_SQL_Agent_Jobs]

@ps1filename = 'c:\downloads\createjobs',

@filename =  'c:\downloads\createjobsscript.sql',

@catfilename = 'c:\downloads\tempcategoryscript.sql', @tempfilename = 'c:\downloads\tempjobsscript.sql'

Works for all three environments and its ugly code but it works. maybe if I get time I will work on it and clean it up.

V1 and V2 of powershell require a slightly different syntax and as a result i have to test for powershell version at end of powershell script for 2008

Total article views: 1971 | Views in the last 30 days: 3
Related Articles

Download: Powershell a Day -April 2011

I you liked my Powershell a day – april 2011, where every day I wrote a blog about powershell you ca...


PowerShell Basics

Powershell. I have seen the word but what is it? This article gives you a basic introduction to what...


HTTP download

HTTP download via SSIS


Article Download

Download Support for the articles


How to download videos

How to download videos