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
2 comments:
[...] - 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/ - [...]
Thank you for this piece of code. I was looking for this.
Post a Comment