View Single Post
Old 06-23-2009   #1 (permalink)
Jeff C


 
 

Starting SQL Server Agent Job

I am trying to buid a script to be used by a person at their desktop machine
to execute a SQL Server Agent job on the server.

I need help sorting out the syntax of a VBS script I found that will do the
job. Any assistance/suggestions appreciated greatly.

2 questions on the script below:

1. ("SQLDMO.SQLServer") should it be (nameofSQLServer.SQLServer)?

2. Using Windows Authentication: can oServer.Connect(".", "user",
p@xxxxxx) be oServer.Connect("nameofSQLServer.SQLServer)??

Dim oJob, oServer

' Creates the SQLDMO SQL Server object

oServer = CreateObject("SQLDMO.SQLServer")

oServer.Connect(".", "user", p@xxxxxx)

' Then Obtains the job to start

oJob = oServer.JobServer.Jobs("MyJob")

' Start the job.

Call oJob.Start()


Thanks in advance

--
Jeff C
Live Well .. Be Happy In All You Do
My System SpecsSystem Spec