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:
> [EMAIL PROTECTED]
> | 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
> ________________________________________________________________________

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to