none
Powershell Add-PrinterDriver for a driver that is not on the remote machine RRS feed

  • Question

  •  

     

     

    I am trying to install a HP universal print driver on about 5 server 2012 computers.

    I could do it one at a time seeing how it is only 5 or so but I thought this would be a great experience to do so with power shell.

     

    Spent half a day messing with this.  What I am reading it the -InfPath parameter just does not work.  I have to say I agree.

    Add-PrinterDriver -ComputerName "01AD-Z1-VLDS12" -Name "HP Universal Printing PCL 5" -InfPath "FileServ1\Private\LAN\Drivers\Printers\Hp\UPD\PCL5_v5.5\x64\hpcu130t.inf

    I have the universal print drivers installed on a share accessible to both.

     I have moved the folder containing all the install files to the local server as well with no luck.

     

    If I run the command  from the server with the files local  Add-PrinterDriver -Name "HP Universal Printing PCL 5" -InfPath "C:\temp\PCL5_v5.5\x64\hpcu130t.inf"

     

    From the server itself I get an error Add-PrinterDriver : Access was denied to the specified resource.

     

     

    Get-Help Add-PrinterDriver -Parameter InfPath was of no use

    Thanks


    Lishron

    Monday, May 11, 2015 6:04 PM

Answers

  • Here is the answer for anyone else in my situation.

    For JRV if you have several offices who seemingly are always buying a printer or replacing one and they cant add them to the print server to share you can simply have them fill out a excel spread sheet with a few pieces of info.  And if like me yo you don't  want to log on the the server(s) each time it can be scripted.  The hold up was if some odd printer did not have a driver. 

    JRV is correct to put it on the server first.  Use the copy item commandlet to get the file(s) to the server.

    Then invoke command -Servername and use the   pnputil as I  did below.    You are then good to go.


    Invoke-Command -ComputerName 01AD-Z1-VLDS12 {pnputil.exe -a "C:\temp\PCL5_v5.5\x64\hpcu130t.inf" }
    Add-PrinterDriver -ComputerName 01AD-Z1-VLDS12 -Name "HP Universal Printing PCL 5"
    Get-PrinterDriver -ComputerName 01AD-Z1-VLDS12
    
    Add-PrinterPort -ComputerName 01AD-Z1-VLDS12 -Name "IP_172.21.206.16" -PrinterHostAddress "172.21.206.16"
    Start-Sleep 10
    Add-Printer -ComputerName "01AD-Z1-VLDS12"  -Name "495-SME-MFP" -ShareName "P49501115300047301"  -PortName IP_172.21.206.16 -DriverName "HP Universal Printing PCL 5"


    Lishron

    • Marked as answer by Lishron Tuesday, May 12, 2015 11:41 AM
    Tuesday, May 12, 2015 11:41 AM

All replies

  • You cannot reference a file on a third machine.  The files must exist on the machine where you want to install the driver.

    \_(ツ)_/

    Monday, May 11, 2015 6:27 PM
  • Thanks.  

    I have moved the files to the local machine

    Add-PrinterDriver -ComputerName "01AD-Z1-VLDS12"  -Name "HP Universal Printing PCL 5" -InfPath "C:\Temp\x64\hpcu130t.inf"

    and


    Add-PrinterDriver -ComputerName "01AD-Z1-VLDS12"  -Name "HP Universal Printing PCL 5" -InfPath "\\01AD-Z1-VLDS12\C$\Temp\x64\hpcu130t.inf"

    Still no luck


    Lishron

    Monday, May 11, 2015 6:33 PM
  • You cannot use a file share to remotely install printer drivers.  If you are using Windows then use a print spooler and it will install all drivers automatically.+

    \_(ツ)_/

    Monday, May 11, 2015 6:58 PM
  • Hmm  

    I don't think you are understanding me.

    Though a power shell script i am trying to install printers that will be shared on the print server.

    here is a snip

    Add-PrinterPort -Name "$portname" -PrinterHostAddress "$IPAddress"
    Add-Printer -ComputerName "$printserver"  -Name "$PrinterName" -ShareName "$ShareName"  -PortName $portname 
    

    The issue is if that driver does not exist on the server it must be installed  


    Lishron

    Monday, May 11, 2015 7:03 PM
  • Then you must install the drivers at the print server.  You cannot install then from a remote share.  The driver installation files must be located on the server where you are installing the drivers.

    If you are trying to connect printers to clients use Group Policy. The drivers will be installed automatically.


    \_(ツ)_/

    Monday, May 11, 2015 7:12 PM

  • I understand that.  As i mentioned above i have installed the drivers on the print server itself.

    I have then tried a few approaches to remotely installing them including 

    Invoke-Command -ComputerName "01AD-Z1-VLDS12" -ScriptBlock {Add-WindowsDriver  -Path "C:\Windows\System32\DriverStore\FileRepository\PCL5_v5.5\x64\hpcu130t.inf" -Driver "HP Universal Printing PCL 5"   }



    The command completes but no drives install.


    Lishron

    Monday, May 11, 2015 7:23 PM
  • I will say this one more time.  If the correct drivers are installed on the print server Windows will download and install them automatically. That is the whole point of using a print server,

    \_(ツ)_/

    Monday, May 11, 2015 7:49 PM
  • Got it.

    But if the drives are not installed on the print server.

    If i get a printer that needs to be shared out on the print server  in a excel spread sheet and there are 20 printers. 

    I can install every one on that print server UNLESS there is no driver.  Then i have to log onto that print server.

    so how do i install a driver on a print server from a remote PC. 

    I know you are rock solid knowledgeable so i know you know i just cant seem to explain it.  

     So i have a HP XXXX model i want to use the HP universal print driver and that driver has never been installed on that server using add windows driver or add printserver driver has no possible way to do it?

    If so what is the proper way.



    Lishron

    • Marked as answer by Lishron Tuesday, May 12, 2015 11:04 AM
    • Unmarked as answer by Lishron Tuesday, May 12, 2015 11:59 AM
    Monday, May 11, 2015 7:58 PM
  • Why do you need to install printer drivers from Excel?  Just attach to the printer.  Everything else is automatic.

    Start by studying how Windows Printing is designed and implemented.  We install printers on a spooler. The printers are shared and have a share name.  When we connect from a client to the spooler the Windows system installs the printer drivers the first time or if there s an update to the driver.  This is all automatic.

    Just install ou printers on yur print server once and everything else is automatic.  User can chose to use any pronter they have permissions on.  All printers are available for printing by everyone by default.


    \_(ツ)_/

    Monday, May 11, 2015 8:09 PM
  • Got it.

    But if the drives are not installed on the print server.

    If i get a printer that needs to be shared out on the print server  in a excel spread sheet and there are 20 printers. 

    I can install every one on that print server UNLESS there is no driver.  Then i have to log onto that print server.

    so how do i install a driver on a print server from a remote PC. 

    I know you are rock solid knowledgeable so i know you know i just cant seem to explain it.  

     So i have a HP XXXX model i want to use the HP universal print driver and that driver has never been installed on that server using add windows driver or add printserver driver has no possible way to do it?

    If so what is the proper way.



    Lishron

    You must copy the driver files to the remote system then you can use the add-printerdriver CmdLet.  You must just first copy them.

    \_(ツ)_/

    • Proposed as answer by jrv Tuesday, May 12, 2015 11:24 AM
    • Unproposed as answer by Lishron Wednesday, May 13, 2015 1:09 AM
    Tuesday, May 12, 2015 11:24 AM
  • Here is the answer for anyone else in my situation.

    For JRV if you have several offices who seemingly are always buying a printer or replacing one and they cant add them to the print server to share you can simply have them fill out a excel spread sheet with a few pieces of info.  And if like me yo you don't  want to log on the the server(s) each time it can be scripted.  The hold up was if some odd printer did not have a driver. 

    JRV is correct to put it on the server first.  Use the copy item commandlet to get the file(s) to the server.

    Then invoke command -Servername and use the   pnputil as I  did below.    You are then good to go.


    Invoke-Command -ComputerName 01AD-Z1-VLDS12 {pnputil.exe -a "C:\temp\PCL5_v5.5\x64\hpcu130t.inf" }
    Add-PrinterDriver -ComputerName 01AD-Z1-VLDS12 -Name "HP Universal Printing PCL 5"
    Get-PrinterDriver -ComputerName 01AD-Z1-VLDS12
    
    Add-PrinterPort -ComputerName 01AD-Z1-VLDS12 -Name "IP_172.21.206.16" -PrinterHostAddress "172.21.206.16"
    Start-Sleep 10
    Add-Printer -ComputerName "01AD-Z1-VLDS12"  -Name "495-SME-MFP" -ShareName "P49501115300047301"  -PortName IP_172.21.206.16 -DriverName "HP Universal Printing PCL 5"


    Lishron

    • Marked as answer by Lishron Tuesday, May 12, 2015 11:41 AM
    Tuesday, May 12, 2015 11:41 AM
  • Awesome.. thanks for the follow up info on what ended up working..

    -m

    Tuesday, January 29, 2019 8:32 PM
  • Has anyone tested Lishiron's suggestion when they were sure the specific driver didn't already exist on the system running the script.

    Just wondering because as far as I know, the second command;

    Add-PrinterDriver -ComputerName 01AD-Z1-VLDS12 -Name "HP Universal Printing PCL 5"
    Is just pulling the driver from the source system (since the InfPath switch is omitted)? I know I can run that line against a remote computer which I've never moved and files to or installed any drivers with PNPUtil and it will successfully add the driver to that system (as long as 'HP Universal Printing PCL 5' is installed on the system running the script).

    George Kendros

    Tuesday, February 11, 2020 3:54 PM
  • Many drivers are pre-installed on newer systems.  I believe the HP Universal driver is part of al systems since at least Windows 8.  Thre is also a Microsft Universal driver that has INF settings for HP and other major vendors.

    For printers that are no pre-installed you will have to copy the driver components to the target system.

    For network printers there is never a need to install a driver as the drivers are installed on the spooler and the spooler copies any needed drivers to teh remote systems when the printer is attached.

    Windows 10 has the HP PCL 6 driver pre-installed.   Dell systems come with their version of a Universal Driver.

    If you open the GUI printer connection wizard on a spooler you will see a long list of printer drivers that are pre-installed with Windows.

    I am pretty sure that the Add-PrinterDriver will now also scan WUSUS and Windows Update for drivers.  I can't prove that right now but MS has been increasing the ability for Windows to do PnP installs seamlessly.


    \_(ツ)_/

    Tuesday, February 11, 2020 4:33 PM
  • Yeah, that was what I was saying.


    Add-PrinterDriver -ComputerName 01AD-Z1-VLDS12 -Name "HP Universal Printing PCL 5"

    Basically; the fact that the above command works doesn't necessarily mean that the commands mentioned above did anything. That command would likely work no matter what because the way its structured is pulling the drivers from the source system. 


    George Kendros

    Tuesday, February 11, 2020 4:51 PM
  • Yeah, that was what I was saying.


    Add-PrinterDriver -ComputerName 01AD-Z1-VLDS12 -Name "HP Universal Printing PCL 5"

    Basically; the fact that the above command works doesn't necessarily mean that the commands mentioned above did anything. That command would likely work no matter what because the way its structured is pulling the drivers from the source system. 


    George Kendros

    Not what I said.  The drivers are not being pulled from the source system.  They already exist on the target system.  I speculated that they may now also be being downloaded from MicrosoftUpdate.

    An article the other day noted that MS was rebuilding their driver delivery system to provide better driver support through automation.

    The command actually uses WMI to install the driver and does not copy any files between systems.  Look at teh WMI documentation for print drivers.  The command is just a wrapper around the WMI class.


    \_(ツ)_/

    Tuesday, February 11, 2020 5:09 PM