起因:昨晚在win7共享打印機電腦升級了補丁,今天下午同事電腦(未升級過補丁)打印出現0x11b,但另一臺升級了補丁卻是正常連接的,打印一切OK。
過程:直接百度上看到的內容大體邏輯都是卸載有關打印機的補丁,但win7找不到具體的補丁型號。所以直接換成谷歌搜索,找到不錯的解決方案,并把該方案做成自動化腳本,一步到位。
其他發現:https://learn.microsoft.com/en-us/answers/questions/563223/windows-cannot-connect-to-the-printer-error-0x0000 在微軟官方論壇上卻沒看到這方面的詳細內容說明,說實話挺意外的。
靈感來源:
https://www.technipages.com/how-to-fix-
windows-printer-error-0x0000011b/
https://www.partitionwizard.com/partitionmagic/error-0x0000011b.html
補上:
https://www.technipages.com/how-to-fix-
windows-printer-error-0x0000011b/
附源碼(補上對應注釋),在升級過補丁的共享打印主機上運行該腳本即可。
home.php?mod=space&uid=251666 以管理員權限運行cmd
@%1 C:\Windows\SysWOW64\mshta.exe vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0::","","runas",1)(window.close)&&exit
@cd /d "%~dp0"
@echo off
@rem 參考鏈接
@REM https://www.technipages.com/how-to-fix-windows-printer-error-0x0000011b/
@REM https://www.partitionwizard.com/partitionmagic/error-0x0000011b.html
@rem 禁用配置打印服務的遠程過程調用(RPC)身份驗證級別
home.php?mod=space&uid=120276 add "HKLM\SYSTEM\CurrentControlSet\Control\Print" /v "RpcAuthnLevelPrivacyEnabled" /t REG_DWORD /d 0 /f
@rem 卸載博客解決方案涉及到的補丁。
@wusa /uninstall /kb:5005565 /quiet
@wusa /uninstall /kb:5005566 /quiet
@wusa /uninstall /kb:5005568 /quiet
@wusa /uninstall /kb:5022497 /quiet
@wusa /uninstall /kb:5012170 /quiet
@wusa /uninstall /kb:5023706 /quiet
@wusa /uninstall /kb:5007186 /quiet
@rem 關閉打印機服務
home.php?mod=space&uid=35508 stop spooler
@rem 清理打印池
home.php?mod=space&uid=324026 /f /s /q C:\Windows\System32\spool\PRINTERS\*
@rem 啟動打印機服務
@net start spooler
@pause