If I try to control or even open some services with all access through win32service.OpenService() (running as administrator) I get "pywintypes.error: (5, 'OpenService', 'Access is denied.')". However, controlling the same services from the Services console is successful. Why is that? Here is sample code to replicate the problem:
import win32service as ws
def get_handle(service_name):
# service_name is the internal service name, not the display name.
hSCManager = ws.OpenSCManager(None, None, ws.SC_MANAGER_ALL_ACCESS)
return ws.OpenService(hSCManager, service_name, ws.SERVICE_ALL_ACCESS)
sh = get_handle("CertPropSvc") # Certificate Propagation, same problem with
# BitLocker Drive Encryption Service (BDESVC)