python create WMI instances

Marc Wyburn future_retro at yahoo.co.uk
Fri Jun 10 06:58:56 EDT 2005


Hi all, I am struggling with a vb - python code conversion.  I'm using
WMI to create printers on remote machines using (in VB);

set oPrinter = oService.Get("Win32_Printer").SpawnInstance_

oPrinter.DriverName = strDriver
oPrinter.PortName   = strPort
oPrinter.DeviceID   = strPrinter
oPrinter.Put_(kFlagCreateOnly)

In python I have logged onto the WMI service on the remote machine and
I can run things like c.new.AddPrinterConnection so I know that I am
connected and working OK.  I don't get any errors when I create a new
object with SpawnInstance_ but when I try to set the value of
oPrinter.Drivername I get an error saying that the Drivername object
doesn't exist.  Does anyone know how to set the values of the object
using either the method above or with the WMI module?  I think the WMI
module only allows access to modify methods such ADDPrinterConnection
or Create (from Win32_Service).

Thanks,MW.



More information about the Python-list mailing list