How to remove a service or change the startup type to disabled
tim.golden at viacom-outdoor.co.uk
Mon Sep 1 09:53:55 CEST 2003
matthew.rapoport at accenture.com (Matt Rapoport) wrote in message news:<4150f6c8.0308291044.2fb26d32 at posting.google.com>...
> I'd like to programmatically remove a service or change its startup
> type to disabled. I know how to remove it from the command line but
> is there another way using the win32 extensions?
1) The win32service module has a load of constants
for this sort of purpose. Do dir (win32service)
and look for things in capitals. At the moment,
I'll leave anyone else on the list who's had experience
of this to answer specifics.
2) Look at:
3) Use wmi. Get the wmi module from
and then do something like this:
c = wmi.WMI () # or c = wmi.WMI ("other_computer")
for service in c.Win32_Service (Name="unuseful_service"):
for service in c.Win32_Service (Name="unwanted_service"):
The loops are just a fudge for the fact the the wmi
query always returns a list, albeit of length one. You
could equally well do:
service = c.Win32_Service (Name="unuseful_service")
although this has the disadvantage (or, possibly, advantage)
of raising an exception if there is no such service.
More information about the Python-list