windows script host and python

Alex Martelli aleaxit at
Fri Mar 16 16:39:53 CET 2001

"bowman" <bowman at> wrote in message
news:8Aps6.104$pl.1515 at
> Syver Enstad <syver at> wrote in message
> news:98oq3r$1e0$1 at
> >
> > Just curious but what do plan to acheive by using python with wsh that
> > couldn't do using normal .py files?
> even more curious: can Python hook up and use WMI from a normal .py?

Sure, why not?  As MS say, in their "Microsoft Windows Management
Instrumentation Scripting" paper,
The WMI SDK includes a scripting API that you use to create scripts
and Visual Basic-based applications to interact with the CIM Object
Manager. It supports the following languages:
Additionally, you can also use any scripting language implementation
that supports Microsoft's Active Scripting technologies with this API
(such as a Perl scripting engine).
and Python (with win32all) DOES support ActiveScripting, of course.

Here, for example, is the "list all running processes" WMI scripting
example translated into Python:

from win32com.client import GetObject

processes = GetObject("winmgmts:{impersonationLevel=impersonate}").\

for process in processes:
    print process.Name


More information about the Python-list mailing list