following code can be used to find if any service is installed and if so then return the state of the service.
import wmi class servicePython(): def __init__(self, serviceName): self.c = wmi.WMI () self.serviceName = serviceName def setServiceName(self, serviceName): self.serviceName = serviceName def getStatus(self): srv = c.Win32_Service (name=self.serviceName) if srv != []: return c.Status return False
[...] – bookmarked by 2 members originally found by Waninkoko on July 13, 2008 Get the windows service state using Python http://mayankjohri.wordpress.com/2008/07/05/get-the-windows-service-state-using-python/ – [...]
Pingback by Bookmarks about Windows — July 17, 2008 @ 1:00 am |
Thanks !
Comment by Poizebottutemi — August 3, 2008 @ 3:55 am |
Thank you for this piece of code. I was looking for this.
Comment by mike — December 15, 2008 @ 12:53 pm |