Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL Server Job to Start Windows Service

Author  Topic 

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2012-03-21 : 15:12:41
Hi everyone,

I want to bounce services on a non=SQl Server server - bu using an Agent Job

I found this extended system procedure (undocumented). it works perfectly for manipulating services on the local machine.

Exec xp_servicecontrol N'stop', N'RVWRouter';

Has anyone found a way of starting/stopping services on a remote server?

Thanks for any ideas. John

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-21 : 15:16:50
why not use a batch command file for that and call it from a job? like below?

http://www.databasejournal.com/features/mssql/article.php/3644906/Automatically-Stopping-and-Restarting-SQL-Server.htm

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2012-03-21 : 15:19:38
You can use sc for this


Go to Top of Page

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2012-03-22 : 09:49:29
Thanks for your ideas visakh16 and Russell.

This is what I need to do:
From Server 1 (SQL Server 2005) - an Agent Job will

- stop & start 3 services on Server 2
- run iisreset on Server 3

I think Services Controller might be good.

But I still need a way of running iisreset on my remote Web Server from my Agent job

Thanks, John
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2012-03-22 : 12:04:14
How remote? Different domain?
Go to Top of Page

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2012-03-22 : 17:07:07
Just need to bounce IIS on another server but within the same domain.
Windows Server 2003
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2012-03-22 : 20:08:27
SC is your ticket then. As long as the account executing it (your SQL Agent Account) is admin on the remote box.
Go to Top of Page
   

- Advertisement -