Check a windows service

awel albert.wellens at gmail.com
Wed Jan 17 14:03:15 EST 2007


Thanks for all 'cause you've really helped me

Just one thing in the last line for the specific service, you' ve
writted :

>    print service

but I think it is :

>    print service.Caption


Tim Golden a écrit :
> awel wrote:
> > Sorry, but could you give me an example with a real service 'cause I've
> > tried this script but nothings happened, no error, nothings ; even if I
> > launch it in cmd prompt.
>
> Well, as that example said, it was designed to show
> automatic services which are not running. If you don't
> have any then nothing will show. I assumed you could
> use this as a starting point.
>
> To list all services try this:
>
> <code>
> import wmi
>
> c = wmi.WMI ()
> for service in c.Win32_Service ():
>   print service.Caption
>
> </code>
>
> To show a specific service:
>
> <code>
> import wmi
>
> c = wmi.WMI ()
> for service in c.Win32_Service (Caption="Task Scheduler"):
>   print service
> 
> </code>
> 
> TJG




More information about the Python-list mailing list