网络打印机安装脚本(rundll32 printui.dll,PrintUIEntry用法示例)
网络打印机安装脚本(rundll32 printui.dll,PrintUIEntry用法示例)

网络打印机安装脚本(rundll32 printui.dll,PrintUIEntry用法示例)

先将以下代码保存成为Add_Printer_Port.reg文件,用于创建网络打印机使用的标准TCP/IP端口:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port]
"Driver"="tcpmon.dll"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports]
"LprAckTimeout"=dword:000000b4
"StatusUpdateEnabled"=dword:00000001
"StatusUpdateInterval"=dword:0000000a

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\172.25.8.13]
"Protocol"=dword:00000002
"Version"=dword:00000002
"HostName"="172.25.8.13"
"IPAddress"=""
"HWAddress"=""
"PortNumber"=dword:00000203
"SNMP Community"="public"
"SNMP Enabled"=dword:00000001
"SNMP Index"=dword:00000001
"PortMonMibPortIndex"=dword:00000001
"Queue"="print"
"Double Spool"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\172.25.8.17]
"Protocol"=dword:00000002
"Version"=dword:00000002
"HostName"="172.25.8.17"
"IPAddress"=""
"HWAddress"=""
"PortNumber"=dword:00000203
"SNMP Community"="public"
"SNMP Enabled"=dword:00000001
"SNMP Index"=dword:00000001
"PortMonMibPortIndex"=dword:00000001
"Queue"="print"
"Double Spool"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\172.25.8.77]
"Protocol"=dword:00000002
"Version"=dword:00000002
"HostName"="172.25.8.77"
"IPAddress"=""
"HWAddress"=""
"PortNumber"=dword:00000203
"SNMP Community"="public"
"SNMP Enabled"=dword:00000001
"SNMP Index"=dword:00000001
"PortMonMibPortIndex"=dword:00000001
"Queue"="print"
"Double Spool"=dword:00000000

然后使用rundll32 printui.dll,PrintUIEntry的方法可以为客户端安装网络打印机,驱动程序位于客户端可以访问的网络路径上,参考以下示例:

REM #*
REM #
REM # Modified by Benson for KONICA MINOLTA Printer in Feb 10 2022
REM # 使用此脚本需要本地安装驱动的权限
REM #
REM #*

@echo off

cls
echo Please log on as administrator to run this script.
echo Press any key or use Ctrl+C to terminate the script and log on as administrator.
pause

echo Import Standard TCP/IP Port register info
regedit /s Add_Printer_Port.reg

echo Remove existing Printer with the same Name to avoid getting copy after copy
rundll32 printui.dll,PrintUIEntry /dl /n "KONICA MINOLTA 367SeriesPS" /q
rundll32 printui.dll,PrintUIEntry /dl /n "KONICA MINOLTA C368SeriesPCL" /q
rundll32 printui.dll,PrintUIEntry /dl /n "KONICA MINOLTA 367SeriesPS(Inside)" /q

echo Installing KONICA MINOLTA 367SeriesPS Printer……
rundll32 printui.dll,PrintUIEntry /if /b "KONICA MINOLTA 367SeriesPS" /f "F:\9-IT\3-drivers\C367 X64\KOAXOA__.INF" /r "172.25.8.13" /m "KONICA MINOLTA 367SeriesPS" /z

echo Installing KONICA MINOLTA C368SeriesPCL Printer……
rundll32 printui.dll,PrintUIEntry /if /b "KONICA MINOLTA C368SeriesPCL" /f "F:\9-IT\3-drivers\C368\C368PCL\IT5PCL6Winx64_11120ZH-CN\KOAXPJ__.INF" /r "172.25.8.17" /m "KONICA MINOLTA C368SeriesPCL" /z

echo Installing KONICA MINOLTA 367SeriesPS(Inside) Printer……
rundll32 printui.dll,PrintUIEntry /if /b "KONICA MINOLTA 367SeriesPS(Inside)" /f "F:\9-IT\3-drivers\C367 X64\KOAXOA__.INF" /r "172.25.8.77" /m "KONICA MINOLTA 367SeriesPS" /z

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

Title - Artist
0:00