Hi all, cannot work this one out at all...
import win32com.client
WBEM =
win32com.client .GetObject(r"wi nmgmts:{imperso nationLevel=imp ersonate}!\\"
+ servername + r"\root\cimv 2")
WBEM.Security_. Privileges.AddA sString("SeLoad DriverPrivilege ")
drv = WBEM.Get("Win32 _PrinterDriver" )
drv.Properties_ ('Name').Value = "HP Color LaserJet 8550 PCL 5C"
drv.Properties_ ('SupportedPlat form').Value = "Windows NT x86"
drv.Properties_ ('Version').Val ue = "3"
drv.Properties_ ('DriverPath'). Value =
"C:\\Printdrive rs\\clj8550pcl5 cwin2kxp"
drv.Properties_ ('InfName').Val ue =
"C:\\Printdrive rs\\clj8550pcl5 cwin2kxp\\hpbf4 01i.inf"
method = drv.Methods_('A ddPrinterDriver ')
InParms = method.InParame ters
InParms.Propert ies_.Item('Driv erInfo').Value = drv
drv.ExecMethod_ ('AddPrinterDri ver',InParms)
If servername is "." the driver loads. If it is a remote machine the
script runs without any errors but no printerdriver is created. As far
as can tell its not a privilege issue and when running through
pythonwin it looks like the object is created but it doesn't show up in
server properties. It also runs too quickly so I'm pretty sure its not
doing anything. I've tried different drivers but no joy.
import win32com.client
WBEM =
win32com.client .GetObject(r"wi nmgmts:{imperso nationLevel=imp ersonate}!\\"
+ servername + r"\root\cimv 2")
WBEM.Security_. Privileges.AddA sString("SeLoad DriverPrivilege ")
drv = WBEM.Get("Win32 _PrinterDriver" )
drv.Properties_ ('Name').Value = "HP Color LaserJet 8550 PCL 5C"
drv.Properties_ ('SupportedPlat form').Value = "Windows NT x86"
drv.Properties_ ('Version').Val ue = "3"
drv.Properties_ ('DriverPath'). Value =
"C:\\Printdrive rs\\clj8550pcl5 cwin2kxp"
drv.Properties_ ('InfName').Val ue =
"C:\\Printdrive rs\\clj8550pcl5 cwin2kxp\\hpbf4 01i.inf"
method = drv.Methods_('A ddPrinterDriver ')
InParms = method.InParame ters
InParms.Propert ies_.Item('Driv erInfo').Value = drv
drv.ExecMethod_ ('AddPrinterDri ver',InParms)
If servername is "." the driver loads. If it is a remote machine the
script runs without any errors but no printerdriver is created. As far
as can tell its not a privilege issue and when running through
pythonwin it looks like the object is created but it doesn't show up in
server properties. It also runs too quickly so I'm pretty sure its not
doing anything. I've tried different drivers but no joy.
Comment