Vehicle-Anti-Theft-Face-Rec.../venv/Lib/site-packages/win32/Demos/win32servicedemo.py

24 lines
579 B
Python
Raw Normal View History

2020-11-12 16:05:57 +00:00
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)
EnumServices()