python create WMI instances

Discussion in 'Python' started by Marc Wyburn, Jun 10, 2005.

  1. Marc Wyburn

    Marc Wyburn Guest

    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.
     
    Marc Wyburn, Jun 10, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Wohlbier
    Replies:
    2
    Views:
    397
    Josiah Carlson
    Feb 22, 2004
  2. Tim Golden

    RE: python create WMI instances

    Tim Golden, Jun 10, 2005, in forum: Python
    Replies:
    2
    Views:
    545
  3. Tim Golden

    RE: python create WMI instances

    Tim Golden, Jun 22, 2005, in forum: Python
    Replies:
    1
    Views:
    403
  4. Tim Golden

    RE: python create WMI instances

    Tim Golden, Jun 23, 2005, in forum: Python
    Replies:
    2
    Views:
    1,580
  5. Replies:
    8
    Views:
    488
    James Stroud
    Jan 29, 2009
Loading...

Share This Page