Disable an NT Service using scripting
Hi,
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.
M
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.
M
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
MSI_repackager
19 years ago
Posted by:
brenthunter2005
19 years ago
You can use WMI in VBScript to accomplish this task:
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.
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")
Next
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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.