def get_services ( ) : with win32 . OpenSCManager ( dwDesiredAccess = win32 . SC_MANAGER_ENUMERATE_SERVICE ) as hSCManager : try : return win32 . EnumServicesStatusEx ( hSCManager ) except AttributeError : return win32 . EnumServicesStatus ( hSCManager )
list all services of windows in python
Retrieve a list of all system services .
def get_services():
        """
        Retrieve a list of all system services.

        @see: L{get_active_services},
            L{start_service}, L{stop_service},
            L{pause_service}, L{resume_service}

        @rtype:  list( L{win32.ServiceStatusProcessEntry} )
        @return: List of service status descriptors.
        """
        with win32.OpenSCManager(
            dwDesiredAccess = win32.SC_MANAGER_ENUMERATE_SERVICE
            ) as hSCManager:
                try:
                    return win32.EnumServicesStatusEx(hSCManager)
                except AttributeError:
                    return win32.EnumServicesStatus(hSCManager)