Lee
(Fresh Scripter)
2004-04-20 12:17 AM
How to I start/stop a W2K service using KIX?

I need to automatically start and stop a service, does anybody know how to do it using KIX commands?

Thanks,
Lee


ShawnAdministrator
(KiX Supporter)
2004-04-20 12:24 AM
Re: How to I start/stop a W2K service using KIX?

Lots of ways to do this. Could use WMI and the WMIService UDF, or could do it with ADSI, or could do it by shelling out to NET START or by using the SC reskit utility, or even the XNET utility that comes with Kixtart ... whats your pleasure ?

-Shawn


Lee
(Fresh Scripter)
2004-04-20 12:59 AM
Re: How to I start/stop a W2K service using KIX?

Hi Shawn, Thanks for the reply, I could do it with the NET STOP/START command, but I am not confident with DOS coz it hangs sometimes and I prefer using kix.

Can you give me an example using the XNET command?

Thanks a lot!


ShaneEP
(MM club member)
2004-04-20 01:24 AM
Re: How to I start/stop a W2K service using KIX?

Hey Lee...

If the service hangs when being stopped/started then it's probably a problem with the service, not DOS. I'm not sure any method would get you around that. But XNET.exe is pretty easy to use.

Shell '%comspec% /c xnet.exe Start Spooler'

would start the spooler service...

Shell '%comspec% /c xnet.exe Stop Spooler'

would stop the spooler service...

There are many other options using xnet.exe...Just type xnet.exe /? at a command and it will list all possible parms.


ShaneEP
(MM club member)
2004-04-20 01:28 AM
Re: How to I start/stop a W2K service using KIX?

And to use Net Stop/Start from within Kix you can do..

Shell '%comspec% /c net stop spooler'

Which would stop the print spooler service.


Lee
(Fresh Scripter)
2004-04-20 04:18 AM
Re: How to I start/stop a W2K service using KIX?

Thanks guys! Your inputs will definitely help me automate the task.

Lee


Sealeopard
(KiX Master)
2004-04-20 05:20 AM
Re: How to I start/stop a W2K service using KIX?

If you would look into the UDF Forum there are actually a multitude of UDSFs that perform actions on services via different OS functionality.