![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | 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 Specs![]() |
| | #2 (permalink) |
| Guest | Re: Starting SQL Server Agent Job "Jeff C" <JeffC@xxxxxx> wrote in message news:89ABF7DC-C561-4C58-B437-B9EA8DD1E0C3@xxxxxx Quote: >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 strings: http://www.connectionstrings.com/ When using Windows Integrated Authentication I use "Trusted_Connection=Yes" in the connection string in place of user name and password. In your example, the "." undoubtedly means the current computer. If your server is called "MyServer", you would use "MyServer" to connect to the default instance. If you have a named instance, for example "MyInstance", use "MyServer\MyInstance". A search on SQLDMO gave me the links below, which might prove more useful: http://www.sqldev.net/sqldmo/SQL-DMO-FAQ.htm http://www.sqlteam.com/article/introduction-to-sql-dmo From the last link I believe you want to use: Set oServer = CreateObject("SQLDMO.SQLServer") oServer.loginsecure = True oServer.Connect("MyServer") where "MyServer" is the name of your server (if there no named instance). I have no idea how to start a job, but I suspect it should be: Set oJob = oServer.JobServer.Jobs("MyJob") where "MyJob" is the name of a job. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Starting SQL Server Agent Job Thanks Richard - the references and your info did the trick! -- Jeff C Live Well .. Be Happy In All You Do "Richard Mueller [MVP]" wrote: Quote: > > "Jeff C" <JeffC@xxxxxx> wrote in message > news:89ABF7DC-C561-4C58-B437-B9EA8DD1E0C3@xxxxxx Quote: > >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 > I'm not familiar with the SQLDMO provider. See this link for connection > strings: > > http://www.connectionstrings.com/ > > When using Windows Integrated Authentication I use "Trusted_Connection=Yes" > in the connection string in place of user name and password. In your > example, the "." undoubtedly means the current computer. If your server is > called "MyServer", you would use "MyServer" to connect to the default > instance. If you have a named instance, for example "MyInstance", use > "MyServer\MyInstance". > > A search on SQLDMO gave me the links below, which might prove more useful: > > http://www.sqldev.net/sqldmo/SQL-DMO-FAQ.htm > > http://www.sqlteam.com/article/introduction-to-sql-dmo > > From the last link I believe you want to use: > > Set oServer = CreateObject("SQLDMO.SQLServer") > oServer.loginsecure = True > oServer.Connect("MyServer") > > where "MyServer" is the name of your server (if there no named instance). I > have no idea how to start a job, but I suspect it should be: > > Set oJob = oServer.JobServer.Jobs("MyJob") > > where "MyJob" is the name of a job. > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| agent.exe? | Vista General | |||
| security package 'kerberos' not starting for server side - what? | Vista performance & maintenance | |||
| ms agent | PowerShell | |||
| Starting MCE 'Live TV' as default Screen when starting after Sleep | Vista General | |||
| Accessing a Linux server behind a BBI Agent Router/Firewall | Vista networking & sharing | |||