Sorry, but could you give me an example with a real service 'cause I've tried this script but nothings happened, no error, nothings ; even if I launch it in cmd prompt.
Thanks Chris Mellon a écrit : > On 16 Jan 2007 09:09:34 -0800, Tim Golden <[EMAIL PROTECTED]> wrote: > > awel wrote: > > > > > 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? > > > > This is one way: > > > > http://tgolden.sc.sabren.com/python/wmi_cookbook.html#automatic_services > > > > You'd have to change that example slightly, but I > > hope the principal is clear enough. If not, ask again. > > > > TJG > > > > Here's some code cut & pasted from the demos included in the win32 module: > > import win32service > import win32con > > > def EnumServices(): > resume = 0 > accessSCM = win32con.GENERIC_READ > accessSrv = win32service.SC_MANAGER_ALL_ACCESS > > #Open Service Control Manager > hscm = win32service.OpenSCManager(None, None, accessSCM) > > #Enumerate Service Control Manager DB > > typeFilter = win32service.SERVICE_WIN32 > stateFilter = win32service.SERVICE_STATE_ALL > > statuses = win32service.EnumServicesStatus(hscm, typeFilter, stateFilter) > for (short_name, desc, status) in statuses: > print short_name, desc, status
-- http://mail.python.org/mailman/listinfo/python-list