win32com (VBScript to Python) problem

Tim Howarth tim at
Tue Nov 25 12:16:25 CET 2003

I'm (very non expert) trying to use a snippet of VBScript (to shut down
Windows workstations) converted to Python but have hit a problem.

The VBScript below work fine;

 Set oWMI=GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\"_
 & pc & "\root\cimv2")
 Set colOperatingSystems = oWMI.ExecQuery("Select * from Win32_OperatingSystem")
 For Each obj in colOperatingSystems
     obj.Win32shutdown 12

but my translation results in "'int' object is not callable" with the
attempted call to Win32Shutdown.

This is with Python 2.3.2 win32all 1.57 or Active Python 2.3.2

print type(obj.Win32ShutDown)
gives int

print obj.Win32ShutDown
gives 87 - the ASCII code of "W" - coincidentally ?

 import win32com.client, sys
 oWMI =
 (Shutdown)}!\\" + pc + r"\root\cimv2")
 colOperatingSystems = oWMI.ExecQuery(r"Select * from Win32_OperatingSystem")
 for obj in colOperatingSystems:

 |im    ---- ARM Powered ----

More information about the Python-list mailing list