Thursday, March 29, 2012

Configure Auto-start option in SQL agent

Is there a way I can set the Auto-start option in SQL Server agent to
true from my program. This can be done through a DOS command, SQL
statement, or anything else I can execute through my program. I know
how to start the agent from my software, I just don't know how to set
it to auto-start.
Any suggestions?You could use the sc.exe command prompt utility (sc config). Check
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/windowsserver2003/proddocs/entserver/sc.asp.
--
Dejan Sarka, SQL Server MVP
FAQ from Neil & others at: http://www.sqlserverfaq.com
Please reply only to the newsgroups.
PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Ray Lavelle" <bostonpartykid@.yahoo.com> wrote in message
news:d8653140.0309061823.6f44952a@.posting.google.com...
> Is there a way I can set the Auto-start option in SQL Server agent to
> true from my program. This can be done through a DOS command, SQL
> statement, or anything else I can execute through my program. I know
> how to start the agent from my software, I just don't know how to set
> it to auto-start.
> Any suggestions?|||Other options include using Service Control Manager e.g.
scm -Silent 1 -Action 7 -Service SQLServerAgent -SvcStartType 2
or from TSQL
exec xp_cmdshell 'scm -Silent 1 -Action 7 -Service
SQLServerAgent -SvcStartType 2'
You could also use SQLDMO from VBScript
--
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Ray Lavelle" <bostonpartykid@.yahoo.com> wrote in message
news:d8653140.0309061823.6f44952a@.posting.google.com...
Is there a way I can set the Auto-start option in SQL Server agent to
true from my program. This can be done through a DOS command, SQL
statement, or anything else I can execute through my program. I know
how to start the agent from my software, I just don't know how to set
it to auto-start.
Any suggestions?|||That worked great, thanks!!!!
"Jasper Smith" <jasper_smith9@.hotmail.com> wrote in message news:<uRJvexUdDHA.2508@.tk2msftngp13.phx.gbl>...
> Other options include using Service Control Manager e.g.
> scm -Silent 1 -Action 7 -Service SQLServerAgent -SvcStartType 2
> or from TSQL
> exec xp_cmdshell 'scm -Silent 1 -Action 7 -Service
> SQLServerAgent -SvcStartType 2'
> You could also use SQLDMO from VBScript
> --
> HTH
> Jasper Smith (SQL Server MVP)
> I support PASS - the definitive, global
> community for SQL Server professionals -
> http://www.sqlpass.org
> "Ray Lavelle" <bostonpartykid@.yahoo.com> wrote in message
> news:d8653140.0309061823.6f44952a@.posting.google.com...
> Is there a way I can set the Auto-start option in SQL Server agent to
> true from my program. This can be done through a DOS command, SQL
> statement, or anything else I can execute through my program. I know
> how to start the agent from my software, I just don't know how to set
> it to auto-start.
> Any suggestions?

No comments:

Post a Comment