I am looking for a simple way to disable an NT Service via a script that can be run automatically when a user logs into their workstation. The desktop environment is Windows XP SP1.

Any suggestions much appreciated.

0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


This has now been resolved:

'I used a free utility called 'XNET.exe' to answer this question. Our company uses a desktop management tool called ProfileMaker from DesktopStandard which I have used to kick off this exe during user log-in.'
Answered 06/15/2005 by: MSI_repackager
Orange Belt

Please log in to comment
You can use WMI in VBScript to accomplish this task:

strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where Name = 'servicename'")

For Each objService in colServiceList
errReturnCode = objService.Change( , , , , "Disabled")

The above code will do the job, but if you are in an Active Directory environment with Group Policies, then I suggest you control the service via a GPO. This way is more dynamic.
Answered 06/15/2005 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity