Page 1 of 1 1
Topic Options
#116278 - 2004-03-17 11:44 AM Disable a service
zdarma Offline
Getting the hang of it

Registered: 2002-10-08
Posts: 83
Can anyone tell me how to disable a service under W2K? I know how to stop, start, pause, re-start and basically anything else I want to do to a service, but disable it. I am currently using NETSVC.EXE to stop/start services through a shell in my script. But I do need to disable the service because otherwise it will restart when the machine is rebooted.

I have tried to use MONITOR.EXE to disable certain services, but it doesn't seem to work.

I've checked Technet (an utter waste of time) and searched the web for an answer. I'm now turning to my fellow Kixsters to see if they have an idea.

Thanks in advance,
Z.

Top
#116279 - 2004-03-17 11:49 AM Re: Disable a service
Bertje Offline
Fresh Scripter

Registered: 2003-09-08
Posts: 39
Loc: The Netherlands
try
net start <service name>
net stop <service name>

I dont know if there is one for restart

Code:
 
Shell "%comspec% /c net start <service name>"
Shell "%comspec% /c net stop <service name>"

_________________________
Greetz, Bertje

Top
#116280 - 2004-03-17 11:57 AM Re: Disable a service
zdarma Offline
Getting the hang of it

Registered: 2002-10-08
Posts: 83
Bertje,

That's basically what I do right now for starting / stopping a service and it works like a charm. I just need to disable the service so that it doesn't start at the reboot. I do the following :

Quote:

Shell '%comspec% /c netsvc "THE SERVICE NAME" \\$answer_nt /stop'




I loooked at using the "manual" arguement, but if the user launches an application that calls the service, it will start the service, and I can't have the service running during a migration.

Thx,
Z.

Top
#116281 - 2004-03-17 12:02 PM Re: Disable a service
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
have you ever heard of xnet ?
Well, it comes with KiXtart distribution and it has the capability of starting/stopping/disabling/installing/removing services even remotely
_________________________



Top
#116282 - 2004-03-17 02:26 PM Re: Disable a service
zdarma Offline
Getting the hang of it

Registered: 2002-10-08
Posts: 83
Oh happy, happy, joy, joy

Thanks, never heard of XNET, always saw the directory with my kix sources, but never gave it much thought. I should have though, it worked like a charm. Thanks for the info.

Z.

Top
#116283 - 2004-03-17 02:38 PM Re: Disable a service
zdarma Offline
Getting the hang of it

Registered: 2002-10-08
Posts: 83
To anyone else who may be interested in using "XNET MODIFY". I'd like to let you konw that, although it isn't mentioned in the help text file (xnet.txt) under the MODIFY section, the command to disable a service is the following (atleast its the one I used and it worked).

Code:
 Shell '%comspec% /c XNET MODIFY "\\MACHINE NAME\SERVICE NAME" /s:DISABLE' 



l8r,
Z.

Top
#116284 - 2004-03-17 02:43 PM Re: Disable a service
Breaker Offline
Hey THIS is FUN
*****

Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
If you have WMI available on the target machines on which you want to disable the service, then WMIService() is available in the UDF library.

You could use (for example):

Code:
$x = WMIService("messenger","STARTMODE","Disabled","computer_name")  



to disable the Messenger service on the remote computer "computer_name".
_________________________
================================================
Breaker


Top
#116285 - 2004-03-17 04:12 PM Re: Disable a service
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
And, oh wonder, there are even UDFs available for this:
fnWMIService - Use the Win32_Service class of WMI to control services
ServiceMode() - Checks/sets the startup mode of a service
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.103 seconds in which 0.064 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org