Heres a script for creating printer ports
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_('Dr
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. M
[EMAIL PROTECTED]
| 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=imper
| sonate}!\\" + "." + r"\root\cimv2")
| >>> printer = WBEM.Get("Win32_Printer").SpawnInstanc
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.Propertie
[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
|
|
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.
--
http://mail.python.
Create isn't a method of Win32_Printer so I couldn't get that to work.
.Create is a method of Win32_Process which (wait for it..) creates a
new process. Unfortunatly there is no method to add a printer. the
method .AddPrinterConnection will allow me to add a connection to an
existing print share
[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.Devic
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_(