Check a windows service

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Jan 16 12:32:33 EST 2007


"awel" <albert.wellens at gmail.com> escribió en el mensaje
news:1168966952.965088.17740 at l53g2000cwa.googlegroups.com...

> I'm new in python and I would like to know if it's possible to check if
> a specific windows service is present and if it's possible how can I
> do?

Yes, using the wmi module, but you'll have to search the Microsoft
documentation on how to enumerate services and their properties:
http://msdn2.microsoft.com/en-us/library/aa384642.aspx
The code might look like this, but the names may be wrong:

import wmi
import pythoncom
pythoncom.CoInitialize()
w = wmi.WMI()
for s in w.Win32_Services():
  print s

-- 
Gabriel Genellina 





More information about the Python-list mailing list