How can I enumerate all windows services and disable some of them?

Discussion in 'Python' started by, Aug 22, 2006.

  1. Guest

    I know that Module win32service has some functions on manipulating
    win32 services.
    But I still have 2 questions:
    1. how to enumerate all services?
    2. how to disable a certain one?

    Thanks in advance!
, Aug 22, 2006
    1. Advertisements


    Roger Upole Guest

    win32service.EnumServicesStatus lists services, and ChangeServiceConfig
    lets you change the start type to disabled.

    import win32service
    for svc in svcs:
    if svc[0]=='PyPipeTestService':
    hsvc=win32service.OpenService(hscm, svc[0], win32service.SERVICE_CHANGE_CONFIG)
    win32service.ChangeServiceConfig(hsvc, win32service.SERVICE_NO_CHANGE,
    win32service.SERVICE_DISABLED, win32service.SERVICE_NO_CHANGE, None, None,0,

    Roger Upole, Aug 22, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.