wmi addprinterdriver for remote PC

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • future_retro@yahoo.co.uk

    #1

    wmi addprinterdriver for remote PC

    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.

  • future_retro@yahoo.co.uk

    #2
    Re: wmi addprinterdrive r for remote PC

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

    Comment

    Working...