Change Printer driver with powershell

Welcome Forums General PowerShell Q&A Change Printer driver with powershell

This topic contains 3 replies, has 2 voices, and was last updated by

 
Participant
5 years, 6 months ago.

  • Author
    Posts
  • #11204

    Participant
    Topics: 3
    Replies: 6
    Points: 0
    Rank: Member

    Hey guys!
    I'm trying to change the driver in one of our printers (150 clients)... It not going to well I most admit.

    OS = Windows 7 x64
    PS version = 2.0

    Try1:

    I trying with these commands:
    Step 1. Import the new driver:
    pnputil -a C:\Users\root\Desktop\HPM400_drivers\*.inf <– that seems to work Output from command: ————————————————— Microsoft PnP Utility Processing inf : hpbuio35l.inf Driver package added successfully. Published name : oem13.inf Processing inf : hpcm401c.inf Driver package added successfully. Published name : oem14.inf Processing inf : hpcm401u.inf Driver package added successfully. Published name : oem15.inf Total attempted: 3 Number successfully imported: 3 ————————————————— So now when the driver is imported I most change the current printer driver of the printer "printer1" to the newly imported. Tried the following commmand: & rundll32 printui.dll PrintUIEntry /Xs /n "printer1" DriverName "drivername" This gives me an error of: "....Windows could cannot locate the suitable driver.." Then I thought I could export the configuration from a allready configured printer with the right driver.. and then Import the settings on another computer... Try 2: Client1 export the configuration: & rundll32 printui.dll PrintUIEntry /Ss /n "printer1" /a "printer1.dat" Client2 Import the configuration: & rundll32 printui.dll PrintUIEntry /Sr /n "printer1" /a "printer1.dat" No luck here either. Export = ok import = fail ...and yes, I imported the new driver before I did the import of the configuration. Any ideas of another solution I should use? Best regard Cristopher Hermansson

  • #11206

    Member
    Topics: 9
    Replies: 2322
    Points: 0
    Rank: Member

    Check out the VBScripts in c:\windows\system32\Printing_Admin_Scripts\en-US\ . Use prndrvr.vbs to install the driver, then prncnfg.vbs to modify the properties of an existing printer (or prnmngr.vbs to create a new one).

    You can either call the scripts from your PowerShell script (using cscript.exe), or you can rewrite them in PowerShell if you'd like; they do all the work using WMI.

  • #11208

    Participant
    Topics: 3
    Replies: 6
    Points: 0
    Rank: Member

    Thanks! Will check this out!

  • #11264

    Participant
    Topics: 3
    Replies: 6
    Points: 0
    Rank: Member

    Ended with that I removed the printer and added it againt. Didn't managed to just switch the printer driver.

The topic ‘Change Printer driver with powershell’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort