python create WMI instances

M

Marc Wyburn

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top