SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 
        
Home       Members    Calendar    Who's On



xp_servicecontrol Expand / Collapse
Author
Message
Posted Wednesday, July 30, 2003 12:35 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:12 AM
Points: 5,934, Visits: 132
Hi there,

can anybody help me with details on how to use xp_servicecontrol?

I've figured out the first parameter could be 'start', 'stop', or 'pause'. Any more?

Then second parameter is the Service name. The same as appears in the control panel?

Any thoughts are appreciated!

Cheers,
Frank

Well, obviously, if there is a 'pause' command there must be something like 'go on' or continue', right?

Edited by - a5xo3z1 on 07/30/2003 12:37:52 AM


--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org
Post #14726
Posted Wednesday, July 30, 2003 4:46 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Sunday, June 28, 2009 3:29 PM
Points: 3,222, Visits: 127
I belive there's also 'continue' and 'querystate'.

An alternative might be xp_cmdshell combined with the (documented) sql "scm" command prompt utility.

...although the undocumented stuff is always more interesting.

Cheers,
- Mark



Cheers,
- Mark
Post #72844
Posted Wednesday, July 30, 2003 4:46 AM
SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: Moderators
Last Login: Wednesday, June 17, 2009 8:22 AM
Points: 8,296, Visits: 478
Here you go.

Parameter 1 can be any of the following.

start
stop
pause
continue
querystate (Almost forgot that one as noted in previous posters post).

Parameter 2 is the Service Name.

For example "FTP Publishing Service" is MSFTPSVC.

Unlike NET command line you cannot substitute the Display Name.



Edited by - antares686 on 07/30/2003 04:48:13 AM



Post #72845
Posted Wednesday, July 30, 2003 4:55 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:12 AM
Points: 5,934, Visits: 132
quote:

start
stop
pause
continue
querystate (Almost forgot that one as noted in previous posters post).

Parameter 2 is the Service Name.

For example "FTP Publishing Service" is MSFTPSVC.


thank you both!

Any secret fountain of wisdom, Antares, you might want to share?

Now, the more interesting one.
I execute this with sa permission.
Am I able to start, stop.. services on that machine, although I am not NT admin to this box?

Of course, this is only for security reasons

Cheers,
Frank


--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org
Post #72846
Posted Wednesday, July 30, 2003 5:05 AM
SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: Moderators
Last Login: Wednesday, June 17, 2009 8:22 AM
Points: 8,296, Visits: 478
No secret there. I just ran it on my testbox here to see what happens when. The only thing that is confusing is that it gives the following error

Server: Msg 22003, Level 16, State 1, Line 0
StartService() returned error 997, 'Overlapped I/O operation is in progress.'



when it is already in the state you are trying to make it.

Also, yes SA can use it to stop and start services but don't tell the OS Admin guys, they would flip.

In addition I seem to recall a few years ago something about SQL having this setup with Public having execute rights but a later patch changed. You might want to check just in case and remove that right. DOes anyone else recall the details on this?





Post #72847
Posted Wednesday, July 30, 2003 5:11 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Sunday, June 28, 2009 3:29 PM
Points: 3,222, Visits: 127
If MSSQLSERVER is running under an admin account you certainly can.

Reminds me of the time I used it (for security purposes) to stop sqlserveragent, start sqlserveragent, stop dhcp, start dhcp, stop mssqlserver..... oops


Cheers,
- Mark



Cheers,
- Mark
Post #72848
Posted Wednesday, July 30, 2003 5:16 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:12 AM
Points: 5,934, Visits: 132
quote:

No secret there. I just ran it on my testbox here to see what happens when. The only thing that is confusing is that it gives the following error


lucky one!
My testbox is SQL7. I was told for some good reasons, I can't remember right now!

quote:

In addition I seem to recall a few years ago something about SQL having this setup with Public having execute rights but a later patch changed. You might want to check just in case and remove that right. DOes anyone else recall the details on this?


I have seen something on http://www.sqlsecurity.com/DesktopDefault.aspx?tabindex=3&tabid=4 . Also, when you google on this topic, you will find some very interesting ppt's from M$. Unfortunately in some asian language

Cheers,
Frank


--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org
Post #72849
Posted Wednesday, July 30, 2003 5:19 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:12 AM
Points: 5,934, Visits: 132
quote:

If MSSQLSERVER is running under an admin account you certainly can.

Reminds me of the time I used it (for security purposes) to stop sqlserveragent, start sqlserveragent, stop dhcp, start dhcp, stop mssqlserver..... oops


that's basically what I thought of!

I have no remote or direct access to that box and hate to call the OS admins to start the SQL Server agent once it has died for some reasons.

Cheers,
Frank


--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org
Post #72850
Posted Wednesday, July 30, 2003 5:21 AM
SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: Moderators
Last Login: Wednesday, June 17, 2009 8:22 AM
Points: 8,296, Visits: 478
quote:

If MSSQLSERVER is running under an admin account you certainly can.

Reminds me of the time I used it (for security purposes) to stop sqlserveragent, start sqlserveragent, stop dhcp, start dhcp, stop mssqlserver..... oops


Cheers,
- Mark



Yeah, I have to try one running under Local System Account but I gotta run so don't have time to test.

And don't feel bad. We use NetOp, PCDuo and Terminal Services and I'll be darned if when working with a few boxes I needed to disable the NIC and Reenable for testing. But for some reason disable stops everything from working for me.




Post #72851
Posted Thursday, July 31, 2003 6:37 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 8:07 PM
Points: 268, Visits: 194
On the same Note, I need to use the "SCM" command line tool to determine if the Service Manager is started during an Installation program. For some reason, the only thing I can get the thing to return to me is...absolutely nothing and an Error. It always tells me it's not running, even when it is! Also, I could not use the SCM to start the Service either.

NOTE: I am using InstallShield Dev 7.2



Post #72852
« Prev Topic | Next Topic »


Permissions Expand / Collapse