/build/static/layout/Breadcrumb_cap_w.png

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

0 Comments   [ + ] Show comments

Answers (2)

Posted by: MSI_repackager 19 years ago
Orange Belt
0
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.'
Posted by: brenthunter2005 19 years ago
Fifth Degree Brown Belt
0
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")
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.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ