I've got as far as this. I don't get any errors but still no
printer
import win32com.client
WBEM =
win32com.client.GetObject(rwinmgmts:{impersonationLevel=impersonate}!\\ +
. + r\root\cimv2)
printer = WBEM.Get(Win32_Printer).SpawnInstance_()
printer.Properties_('DeviceID').Value =
[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(rwinmgmts:{impersonationLevel=imper
| sonate}!\\ + . + r\root\cimv2)
| printer = WBEM.Get(Win32_Printer).SpawnInstance_()
|
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.
Heres a script for creating printer ports
import win32com.client
WBEM =
win32com.client.GetObject(rwinmgmts:{impersonationLevel=impersonate}!\\
+ . + r\root\cimv2)
printer = WBEM.Get(Win32_Printer).SpawnInstance_()
printer.Properties_('DeviceID').Value = 'myprinter'
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
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.
--
[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
|
|
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
[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
|