RE: python create WMI instances

Discussion in 'Python' started by Tim Golden, Jun 22, 2005.

  1. Tim Golden

    Tim Golden Guest

    []
    | Win32_Printer doesn't work with the Create method and
    | AddPrinterConnection only lets me add a connection to a share. I'll
    | try and work out how to set the printer object properties in
    | the format
    | suggested;
    |
    | oPrinter.Properties_ ("DriverName").Value = strDriver
    |
    | Cheers, MW.

    I'm sorry my module won't have been much use to you
    in this, but it would be *really* helpful if you
    could post [a fragment of] the code you come up with
    so I can see what changes I need to make to help our
    future instance-spawners. It's just that I've never
    had the need to do this, and don't have any time to
    experiment at present.

    Thanks
    TJG

    ________________________________________________________________________
    This e-mail has been scanned for all viruses by Star. The
    service is powered by MessageLabs. For more information on a proactive
    anti-virus service working around the clock, around the globe, visit:
    http://www.star.net.uk
    ________________________________________________________________________
    Tim Golden, Jun 22, 2005
    #1
    1. Advertising

  2. Tim Golden

    Guest

    I've got as far as this. I don't get any errors but still no
    printer????

    >>> import win32com.client
    >>> WBEM = win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\" + "." + r"\root\cimv2")
    >>> printer = WBEM.Get("Win32_Printer").SpawnInstance_()
    >>> printer.Properties_('DeviceID').Value = 'myprinter'
    >>> printer.Properties_('DriverName').Value = 'HP 2000C'
    >>> printer.Properties_('Location').Value = 'myoffice'
    >>> printer.Properties_('Network').Value = 'True'
    >>> printer.Properties_('Shared').Value = 'True'
    >>> printer.Properties_('ShareName').Value = 'myprintershare'
    >>> printer.Put_


    Do I need to specify any flags with Put_ ?

    Thanks for all your help, I can almost taste victory!

    MW.

    Tim Golden wrote:
    > []
    > | Win32_Printer doesn't work with the Create method and
    > | AddPrinterConnection only lets me add a connection to a share. I'll
    > | try and work out how to set the printer object properties in
    > | the format
    > | suggested;
    > |
    > | oPrinter.Properties_ ("DriverName").Value = strDriver
    > |
    > | Cheers, MW.
    >
    > I'm sorry my module won't have been much use to you
    > in this, but it would be *really* helpful if you
    > could post [a fragment of] the code you come up with
    > so I can see what changes I need to make to help our
    > future instance-spawners. It's just that I've never
    > had the need to do this, and don't have any time to
    > experiment at present.
    >
    > Thanks
    > TJG
    >
    > ________________________________________________________________________
    > This e-mail has been scanned for all viruses by Star. The
    > service is powered by MessageLabs. For more information on a proactive
    > anti-virus service working around the clock, around the globe, visit:
    > http://www.star.net.uk
    > ________________________________________________________________________
    , Jun 23, 2005
    #2
    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:
    354
    Josiah Carlson
    Feb 22, 2004
  2. Marc Wyburn

    python create WMI instances

    Marc Wyburn, Jun 10, 2005, in forum: Python
    Replies:
    0
    Views:
    294
    Marc Wyburn
    Jun 10, 2005
  3. Tim Golden

    RE: python create WMI instances

    Tim Golden, Jun 10, 2005, in forum: Python
    Replies:
    2
    Views:
    515
  4. Tim Golden

    RE: python create WMI instances

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

Share This Page