How can I enumerate all windows services and disable some of them?

Tim Golden tim.golden at viacom-outdoor.co.uk
Wed Aug 23 10:48:23 EDT 2006


Tim Golden wrote:
> [Tim Golden]
>
> | [could.net at gmail.com]
> |
> | | I know that Module win32service has some functions on manipulating
> | | win32 services.
> | | But I still have 2 questions:
> | | 1. how to enumerate all services?
> | | 2. how to disable a certain one?
> |
> | You can use WMI to do this if you want.
>

(continues talking to self...)

In fact you *can* do this with WMI.
eg, to disable the Alerter service:

<code>
import wmi
c = wmi.WMI ()
for service in c.Win32_Service (Caption="Alerter"):
  service.Change (StartMode="Disabled")

</code>

TJG




More information about the Python-list mailing list