wmi addprinterdriver for remote PC

F

future_retro

Hi all, cannot work this one out at all...

import win32com.client
WBEM =
win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\"
+ servername + r"\root\cimv2")
WBEM.Security_.Privileges.AddAsString("SeLoadDriverPrivilege")
drv = WBEM.Get("Win32_PrinterDriver")
drv.Properties_('Name').Value = "HP Color LaserJet 8550 PCL 5C"
drv.Properties_('SupportedPlatform').Value = "Windows NT x86"
drv.Properties_('Version').Value = "3"
drv.Properties_('DriverPath').Value =
"C:\\Printdrivers\\clj8550pcl5cwin2kxp"
drv.Properties_('InfName').Value =
"C:\\Printdrivers\\clj8550pcl5cwin2kxp\\hpbf401i.inf"
method = drv.Methods_('AddPrinterDriver')
InParms = method.InParameters
InParms.Properties_.Item('DriverInfo').Value = drv
drv.ExecMethod_('AddPrinterDriver',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.
 
F

future_retro

soz I missed the glaring error. The file paths need to be to a UNC
location of have to exist on the remote PC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top