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]. >>> 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 -- http://mail.python.org/mailman/listinfo/python-list