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

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

  1. Tim Golden

    Tim Golden Guest

    [Tim Golden]

    | []
    |
    | | 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?
    |
    | You can use WMI to do this if you want.

    .... or I could actually read the question before answering.
    I don't know if you can actually *disable* a service
    from WMI. You can certainly stop it, but the status appears
    to be a read-only option.

    Sorry
    TJG

    ________________________________________________________________________
    This e-mail has been scanned for all viruses by Star. The
    service is powered by MessageLabs. For more information on a proactive
    anti-virus service working around the clock, around the globe, visit:
    http://www.star.net.uk
    ________________________________________________________________________
     
    Tim Golden, Aug 22, 2006
    #1
    1. Advertising

  2. Tim Golden

    Tim Golden Guest

    Tim Golden wrote:
    > [Tim Golden]
    >
    > | []
    > |
    > | | 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?
    > |
    > | You can use WMI to do this if you want.
    >


    (continues talking to self...)

    In fact you *can* do this with WMI.
    eg, to disable the Alerter service:

    <code>
    import wmi
    c = wmi.WMI ()
    for service in c.Win32_Service (Caption="Alerter"):
    service.Change (StartMode="Disabled")

    </code>

    TJG
     
    Tim Golden, Aug 23, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J
    Replies:
    3
    Views:
    7,158
  2. GS
    Replies:
    1
    Views:
    14,946
    Karl Seguin
    Jan 9, 2006
  3. Anonieko

    HttpHandlers - Learn Them. Use Them.

    Anonieko, Jun 15, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    542
    tdavisjr
    Jun 16, 2006
  4. Replies:
    1
    Views:
    422
    Roger Upole
    Aug 22, 2006
  5. Andrés Giraldo
    Replies:
    1
    Views:
    74
    Lasse Reichstein Nielsen
    Oct 5, 2003
Loading...

Share This Page