<code - untested>
> import wmi
> >
> > servers = open ("c:/servernames.txt").read ().splitlines ()
> > for server in servers:
> > wmi_connection = wmi.WMI (server)
> > with open ("%s-services.log" % server, "w") as f:
> > for service in wmi_connection.Win32_Service ():
> > f.write ("%s\t%s\n" % (service.Caption, service.State))
> >
> > </code>
> >
> > HTH
> > TJG
> > _______________________________________________
> > python-win32 mailing list
> > [email protected]
> > http://mail.python.org/mailman/listinfo/python-win32
> >
>
> Note that the above code will only work under Python 2.5, since that's
> when the "with" statement was added.
>
> (Some of us are still stuck in 2.4 land :) )
>
>
If I am not mistaken, you can use the with statement with python 2.4
from __future__ import with_statement
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32