python create WMI instances

future_retro at future_retro at
Thu Jun 23 16:22:41 CEST 2005

Right I got it working.  I had to put a printer port in aswell.  I'll
now look at a script to create printer ports.  My goal is being able to
query the printers on print server x and then recreate the printers
(shares and ports) on print server y.

Thanks, for all your help Tim, much appreciated. MW

import win32com.client
+ "." + 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.Properties_('PortName').Value = 'IP_169.254.110.14'

More information about the Python-list mailing list