使用Powershell从服务器中提取打印驱动程序并将其安装到工作站



上下文:我的最终目标是从印刷噩梦中醒来。为此,我计划创建一个脚本,该脚本将通过安装打印驱动程序和网络打印机的GPO进行部署。下面是我正在使用的测试脚本。

脚本:

pnputil.exe /a "\j001-hal2010HP Universal Print Driverpcl6-x64-7.0.0.24832hpcu250u.inf"
Add-PrinterDriver -Name "HP Universal Printing PCL 6" -InfPath "C:WindowsSystem32DriverStorehpcu250u.inf"
Add-PrinterPort -Name "TCPPort:10.1.1.193" -PrinterHostAddress "10.1.1.193"
Add-Printer -DriverName "HP Universal Printing PCL 6" -Name "Cust Service HP Color LaserJet M653" -PortName "TCPPort:10.1.1.193"

问题:我的问题是pnputil.exe /a "\j001-hal2010HP Universal Print Driverpcl6-x64-7.0.0.24832hpcu250u.inf"返回时出现以下错误:

添加驱动程序包失败:作为参数传递的INF无效。

当我为INF插入Wilcard时,我收到相同的错误:pnputil.exe /a "\j001-hal2010HP Universal Print Driverpcl6-x64-7.0.0.24832*.inf"

添加驱动程序包失败:作为参数传递的INF无效。

尝试总数:0成功导入的数量:0

资源:

https://www.pdq.com/blog/using-powershell-to-install-printers/

https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/pnputil-command-syntax

听起来你没有通过源代码的身份验证。我得到了这个,直到我添加了一个net use x:\j001-hal2010\并输入了用户名和密码。然后我可以运行pnputil.exe/a";\j001-hal2010\HP通用打印驱动程序\pcl6-x64-7.0.024832*.inf";

最新更新