Security Basics mailing list archives

RE: Script


From: <peter.schaub () thomson com>
Date: Wed, 25 Jul 2007 16:50:47 -0400

Quick VB script example from the Microsoft Scripting Guys forums:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/hsgarch.ms
px
'''''''''''''''''
'Set the Computer Browser Service to disabled on local node'
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")

Set colServiceList = objWMIService.ExecQuery _
    'Set the service name below'
    ("Select * from Win32_Service where Name = 'Browser'")

For Each objService in colServiceList
    If objService.State = "Running" Then
        objService.StopService()
        Wscript.Sleep 5000
    End If
    errReturnCode = objService.ChangeStartMode("Disabled")   
Next 

'''''''''''''''''

This can be repeated for other services, and the 'ChangeStartMode' can
also be toggled from automatic > manual > disabled. Put this in the
'start' up folder, and it will run each time a user logs on, and will
configure the services as needed.

Hope this helps a bit,
~Peter
-----Original Message-----
From: listbounce () securityfocus com [mailto:listbounce () securityfocus com]
On Behalf Of Hoover, Travis
Sent: Wednesday, July 25, 2007 3:18 PM
To: 'Siscar, Emerson E.'; security-basics () securityfocus com
Subject: RE: Script

From command line, run sc.exe /?

This should help for disabling services...

-Travis

-----Original Message-----
From: listbounce () securityfocus com [mailto:listbounce () securityfocus com]
On Behalf Of Siscar, Emerson E.
Sent: Tuesday, July 24, 2007 11:57 PM
To: security-basics () securityfocus com
Subject: Script



Hello to all:



Am not into script writing yet. Can anyone recommend or know where I
could find/get a script that disables windows unnecessary services for
example?



Thank you



Emer


Current thread: