Check a windows service
Tim Golden
tjgolden at gmail.com
Wed Jan 17 05:36:25 EST 2007
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