Security Basics mailing list archives

Re: Scripting to disable services


From: jfvanmeter () comcast net
Date: Wed, 19 Sep 2007 07:49:53 +0000

If your using Group Policy you could disable all of the service that way,  you could also set a acl on the service so 
only a limited number of personnel can restart it. but the workstations/server would need to be rebooted for the 
service to stop.

Something like this could stop the service, but with out it being disabled if the workstation of server is rebooted the 
service will start again.

strService = " 'Alerter' "
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where Name ="_
& strService & " ")
For Each objService in colListOfServices
objService.StopService()

we could add something like this to disable it it. But a user could open the services snap in and reset every thing and 
re start the service.

For Each objService In colServiceList 
wscript.Echo objservice.name 
objService.ChangeStartMode("Disabled") 
Next 

Personnel I would do it via group policy, and force/wait for a reboot. That way the service will remain disabled and 
could not be restarted by a user.

Take care and have fun --John

 -------------- Original message ----------------------
From: twofish () gmail com
Howdy!


I'm trying to find a way to script a mass disable of services on a series of 
standalone WinXP SP2 boxes.


I need to be able to be run it locally under admin, without installing 
additional software (i.e. default XP SP2).


Need to disable about 25 services. 


Additionally, anyone with knowledge of systems set up under NISPOM standards:  
I'm getting a TON of 560 failures.  Any techniques on audit log reductions?


Thanks!

d




Current thread: