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

本文介绍了如何通过创建一个Add_Printer_Port.reg文件来建立网络打印机的TCP/IP端口,并利用rundll32 printui.dll,PrintUIEntry命令来安装网络打印机,其中驱动程序存放在网络共享位置。" 53945642,1371809,使用Shell脚本将数据文件导入Hive表,"['shell', 'Hive', '数据处理', '自动化任务', '大数据']

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

 

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE
SYSTEMCurrentControlSetControlPrintMonitorsStandard TCP/IP PortPorts]
"StatusUpdateInterval"=dword:0000000a
"StatusUpdateEnabled"=dword:00000001

[HKEY_LOCAL_MACHINE
SYSTEMCurrentControlSetControlPrintMonitorsStandard TCP/IP PortPortsIP_10.xx.xx.xx]
"Protocol"=dword:00000001
"Version"=dword:00000001
"HostName"=""
"IPAddress"="10.xx.xx.xx"
"HWAddress"=""
"PortNumber"=dword:0000238c
"SNMP Community"="public"
"SNMP Enabled"=dword:00000001
"SNMP Index"=dword:00000001

 

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

 

REM #*************************************************************************************
REM
 #
REM
 # Modified by Acer for YK Printer hp LaserJet 1300 PS in Dec 06 2005
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.
echo Import Standard TCP/IP Port register info
regedit 
/s Add_Printer_Port.reg

echo.
echo After making changes to the registry, the Spooler service must be restarted for the new ports to be available.
net stop spooler & net start spooler

REM #*************************************************************************************
REM
 #
REM
 # /ia 用 inf 文件安装打印机驱动程序
REM
 # /if 用 inf 文件安装打印机
REM
 # /b[name] 基本打印机名
REM
 # /c[name] 如果操作在远程机器上,unc 机器名
REM
 # /dl 删除本地打印机
REM
 # /dn 删除网络打印机连接
REM
 # /dd 删除打印机驱动程序
REM
 # /f[file] inf 文件或输出文件
REM
 # /h[arch] 驱动程序体系结构,为下列之一: Alpha | Intel | IA64
REM
 # /m[model] 打印机驱动程序型号名
REM
 # /n[name] 打印机名
REM
 # /v[version] 驱动程序版本属于下列中的一个: Windows 95、98 和 ME | Windows NT 4.0 | Windows NT 4.0 或 2000 | Windows 2000 或 XP|  Windows XP 
REM
 # /q 安静模式,不显示错误信息
REM
 # /r[port] 端口名
REM
 # /y 将打印机设为默认打印机
REM
 # /z 不要自动共享这台打印机
REM
 # /Z 共享这台打印机,只能跟 /if 选项一起使用
REM
 #
REM
 #
REM
 # 更多的帮助请使用rundll32 printui.dll,PrintUIEntry /?
REM
 #
REM
 #*************************************************************************************

echo Remove existing Printer with the same Name to avoid getting copy after copy
rundll32 printui
.dll,PrintUIEntry /dl /"hp LaserJet 1300 PS" /q

echo .
echo Installing hp LaserJet 1300 PS Printer......
rundll32 printui
.dll,PrintUIEntry /if /"hp LaserJet 1300 PS" /"/MyServerPrint Drivershp1300Nlj1300pswin2kxp-schp1300mp.inf" /"IP_10.xx.xx.xx" /"hp LaserJet 1300 PS" /z
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值