简体   繁体   English

通过 PowerShell 添加打印机不允许我打印但添加它虽然控制面板会

[英]adding a printer through PowerShell doesn't allow me to print but adding it though control panel will

I'm trying to test adding printers through PowerShell and I've had 1 successful test by adding a printer already added to the pc through PowerShell by removing the printer through control panel then running the PowerShell script:我正在尝试通过 PowerShell 测试添加打印机,并且通过通过控制面板删除打印机然后运行 ​​PowerShell 脚本,通过添加已通过 PowerShell 添加到 PC 的打印机,我已经进行了 1 次成功测试:
Add-Printer -Name "Xerox WorkCentre 6605DN V4 PCL6" -DriverName "Xerox WorkCentre 6605DN V4 PCL6" -PortName "192.168.0.80" then i varied the code for the new printer: Add-Printer -Name "Xerox WorkCentre 6605DN V4 PCL6" -DriverName "Xerox WorkCentre 6605DN V4 PCL6" -PortName "192.168.0.80"然后我改变了新打印机的代码:
Add-Printer -Name "Brother MFC-L5750DW series Printer" -DriverName "Microsoft IPP Class Driver" -PortName "192.168.0.141"
but when I've tried it from a brand new printer that wasn't already added to the computer it doesn't work I have run both the add-printerport 192.168.0.141 and add-printerdriver "Microsoft IPP Class Driver" and those seemed to work but whenever I add the printer with the script and try and print a test page it appears in the print queue for less than a second and nothing comes out but, when I remove it and add the printer through control panel it allows me to print test pages no problem I've looked through the settings and it has all the same setting as when I added it through PowerShell, The computer is on the same network as the the printer and the printer port is the same both times但是当我从一台尚未添加到计算机的全新打印机上尝试它时它不起作用我已经运行了add-printerport 192.168.0.141add-printerdriver "Microsoft IPP Class Driver"并且那些似乎工作,但每当我用脚本添加打印机并尝试打印测试页时,它会出现在打印队列中不到一秒钟,什么也没有出现,但是,当我删除它并通过控制面板添加打印机时,它允许我打印测试页没问题我已经查看了设置,它的设置与我通过 PowerShell 添加时的设置完全相同,计算机与打印机在同一网络上,并且两次打印机端口都相同

I'm not sure what to try to fix this我不知道如何尝试解决这个问题
I've re-asked this question on stack exchange superuser please answer there if you have an answer我在堆栈交换超级用户上重新问过这个问题,如果你有答案,请在那里回答

I've figured out why it wasn't working, the port name was somehow screwing up(or that's as much as I can assume) so instead of:我已经弄清楚为什么它不起作用,端口名称不知何故搞砸了(或者我可以假设)所以而不是:

add-printerport 192.168.0.141

I used:我用了:

add-printerport -name "bp" -printerhostaddress "192.168.0.141"

than added the printer with the new port name of "bp" and it prints correctly now i also used a different built in Microsoft driver "Microsoft PCL6 Class Driver" which may be a reason for success除了添加带有新端口名称“bp”的打印机,它现在可以正确打印我还使用了不同的内置 Microsoft 驱动程序“Microsoft PCL6 类驱动程序”,这可能是成功的原因

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM