Re: [python-win32] Fwd: Using Python and WMI for multiple machines

2008-02-21 Thread Tim Golden
Kevin Horn wrote: > On Feb 20, 2008 3:04 AM, Tim Golden <[EMAIL PROTECTED]> wrote: [... snip Python 2.5+ code example ...] > 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 :) ) > > In 2.4 a

Re: [python-win32] Fwd: Using Python and WMI for multiple machines

2008-02-20 Thread Graeme Glass
> If I am not mistaken, you can use the with statement with python 2.4 > > from __future__ import with_statement > > > Um, forget that. That is 2.5 like you said. Sorry. Don't have 2.4 installed anymore to test my brain farts before sending them on. *Jedi mind trick* You never saw this mail __

Re: [python-win32] Fwd: Using Python and WMI for multiple machines

2008-02-20 Thread Graeme Glass
> 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" % (

[python-win32] Fwd: Using Python and WMI for multiple machines

2008-02-20 Thread Kevin Horn
On Feb 20, 2008 3:04 AM, Tim Golden <[EMAIL PROTECTED]> wrote: > Becky Mcquilling wrote: > > I'm new to Python and wanted to do what is a pretty routine and common > admin > > function, simple enough in VBScript, but wanted to try it in Python as > > well. I'm having troulbe working it out on my