Thanks for your answers,
The security wouldn't be a concern, as I would run while being only accessible by trusted hosts. I don't use the script often, so if it would start a WMI service during runtime and stop it afterwards it would be fine. I just wonder whether installing another 3rd party package for just listing all services s worth the effort. In my current case I'll go probably for parsing the output of "sc.exe query" or I'll traverse the registry. currently I just want to get a list of the names of the running services. bye N Alf P. Steinbach wrote: > * alex23: >> News123 <news...@free.fr> wrote: >>> What is the best way with python to get a list of all windows services. >>> >>> As a start I would be glad to receive only the service names. >>> >>> However it would be nicer if I could get all the properties of a service >>> as well. >> >> I highly recommend Tim Golden's fantastic WMI module[1]. > > It's probably Very Good, but one Microsoft-thing one should be aware of: > using WMI functionality generally starts up a background WMI service... > > Similarly, starting the standard clipboard viewer (discontinued in > Windows Vista) starts up a silly copy-clipboard-contents-over-network > service. > > On a low-range machine the WMI service can be a resource concern. > > I don't know whether the WMI service is a security concern (it probably > is, considering IIS and anything Microsoft+Network and that WMI is meant > to administrate machines over network, it's an enterprise thing not a > personal computer user thing), but the clipboard service is, as I > recall, a concern. > > >> >>> import wmi >> >>> c = wmi.WMI() >> >>> services = c.Win32_Service() >> >>> s = services[0] >> >>> s >> <_wmi_object: \\LIB-D5NYF1S\root >> \cimv2:Win32_Service.Name="Alerter"> >> >>> s.properties >> {u'DisplayName': None, u'ServiceSpecificExitCode': None, u'State': >> None, u'Syste >> mName': None, u'ErrorControl': None, u'Status': None, >> u'ProcessId': None, u'Desc >> ription': None, u'Started': None, u'AcceptStop': None, >> u'CheckPoint': None, u'Pa >> thName': None, u'WaitHint': None, u'Name': None, u'InstallDate': >> None, u'Caption >> ': None, u'StartMode': None, u'DesktopInteract': None, >> u'ServiceType': None, u'T >> agId': None, u'StartName': None, u'AcceptPause': None, >> u'CreationClassName': Non >> e, u'SystemCreationClassName': None, u'ExitCode': None} >> >>> s.Name >> u'Alerter' >> >>> s.Started >> False >> >>> s.ServiceType >> u'Share Process' >> >> 1: http://timgolden.me.uk/python/wmi/index.html > > Cheers, > > - Alf -- http://mail.python.org/mailman/listinfo/python-list