在 Windows 中如何在无用户交互的情况下添加打印机
察看本文应用于的产品
文章编号 : 189105
最后修改 : 2006年1月23日
修订 : 5.1
概要
Windows 2000 和 Windows Server 2003 提供使用命令行安装打印机的功能。当您使用登录脚本或预定事件从一组用户添加或删除打印机时,此功能尤其有用。
虽然 Microsoft Windows NT 4.0 Zero Administration Kit (ZAK) 包含一些诸如 Con2prt.exe 的工具,但是通过 Con2prt.exe 工具,只能添加或删除网络打印机。您还可以使用 Windows 2000 修改和删除本地打印机。因此,管理员可以通过使用户运行批处理文件或登录脚本,从而控制用户打印能力的所有方面。
注意:如果在登录脚本或客户端启动的批处理文件中使用此命令,则客户端计算机需要运行 Windows 2000 或 Windows Server 2003。由于要在客户端计算机上运行登录脚本,因此 Windows NT 4.0 客户端无法处理此命令。
这篇文章中的信息适用于:
? Microsoft Windows 2000 Server
? Microsoft Windows 2000 Professional Edition
? Microsoft Windows Server 2003 Standard Edition
? Microsoft Windows Server 2003 Datacenter Edition
? Microsoft Windows Server 2003 Enterprise Edition
? Microsoft Windows Server 2003 Web Edition
回到顶端
关键字: kbhowto kbprint KB189105
用rundll32.exe 吧!
我用过的,直接放在unattention.sif [runonce]中加入这方面的脚本。
具体使用方法请见:
用法: rundll32 printui.dll,PrintUIEntry [options] [@commandfile]
/a[file] 二进制文件名
/b[name] 基本打印机名
/c[name] 如果操作在远程机器上,unc 机器名
/dl 删除本地打印机
/dn 删除网络打印机连接
/dd 删除打印机驱动程序
/e 显示打印首选项
/f[file] inf 文件或输出文件
/ga 添加每个机器打印机连接
/ge 枚举每个机器打印机连接
/gd 删除每个机器打印机连接
/h[arch] 驱动程序体系结构,为下列之一: Alpha | Intel | IA64
/ia 用 inf 文件安装打印机驱动程序
/id 用添加打印机驱动程序向导安装打印机驱动程序
/if 用 inf 文件安装打印机
/ii 用带 inf 文件的添加打印机向导安装打印机
/il 用添加打印机向导安装打印机
/in 添加网络打印机连接
/j[provider] 打印提供程序名称
/k 将测试页打印到指定的打印机,不能安装打印机时的命令组合
/l[path] 打印机驱动程序源路径
/m[model] 打印机驱动程序型号名
/n[name] 打印机名
/o 显示打印机队列查看
/p 显示打印机属性
/q 安静模式,不显示错误信息
/r[port] 端口名
/s 显示服务器属性
/Ss 将打印机设置存到一个文件
/Sr 从一个文件还原打印机设置
储存或还原必须放在命令结尾的打印机设置选项标志:
2 PRINTER_INFO_2
7 PRINTER_INFO_7
c 颜色配置文件
d 打印机数据
s 安全描述符
g 全局 DevMode
m 最低设置
u 用户 DevMode
r 解决名称冲突
f 强制使用名称
p 解析端口
/u 如果已安装,则使用现有的打印机驱动程序
/t[#] 起始的以零为基础的索引页
/v[version] 驱动程序版本属于下列中的一个: Windows 95、98 和 ME | Windows NT 4.0 | Windows NT 4.0 或 2000 | Windows 2000 或 XP| Windows XP
/w 如果指定的驱动程序不在 inf 中,则提示用户
/y 将打印机设为默认打印机
/Xg 获得打印机设置
/Xs 设定打印机设置
/z 不要自动共享这台打印机
/Z 不要自动生成打印机名
/K 更改 /v 和 /h 的意义来将 Windows IA64 | Windows NT x86 | Windows NT Alpha_AXP | Windows 4.0 分别接受为 0、1、2、3
/Z 共享这台打印机,只能跟 /if 选项一起使用
/? 帮助信息
@[file] 命令行参数文件
/Mw[message] 确认命令之前显示警告消息
/Mq[message] 确认命令之前显示确认消息
/W[flags] 指定向导(APW 和 APDW)的标志和切换
r 使向导可以从上一页重新启动
/G[flags] 指定全局标志和切换
w 抑制安装程序驱动程序警告 UI (超级静声模式)
[ Last edited by rubik on 2007-1-6 at 12:49 AM ]作者: rubik 时间: 2007-1-5 23:47 标题: 没人理睬?
今天又搜索了一天,找到点好东西,先放在这儿分享一下,马上试
-----------------
This tip was submitted to the SearchWin2000.com tip exchange by member David Savoie. Please let other users know how useful it is by rating it below.
This tip explains how to create printer ports and shared printers programmatically in a clustered environment.
Assumptions:
Kerberos support for the cluster has been enabled for each clustered resource as per: PSS ID Number: 235529
Access to Resource Kit Utility REGINI
There are two steps to this process:
Define printer ports on each node of the cluster.
Create shared printers on each node of the cluster.
Define printer ports:
NOTE: Printer ports should be defined on each node of the cluster. If you have a range of printers, you may want to manually split the range between the two virtual nodes.
Step1: Use IP.bat to Create portmaker batch file.
Rename IP.txt to Portmaker.bat. This file will be used to create ports on PRINT_NODE1 node of the cluster.
Perform the same process for PRINT_NODE2. Modify IP.bat to reflect the new range of printer ports and PRINT_NODE:
FOR /L %%I IN (128,1,254) DO CALL :TEST %%I
Listing for IP.bat
FOR /L %%I IN (0,1,127) DO CALL :TEST %%I
Port.bat creates the port.ini file that Portcreate.bat uses to apply the registry changes using the Regini Resource Kit utility. Note the GUID. Each virtual server stores its resources under a different GUID. You will need to verify this manually using REGEDT32.
NOTE: If the driver does not exist on the second node, you can run the following command on the second node to install the driver:
rundll32 printui.dll , PrintUIEntry /id
You may need to stop and start the cluster service on each node to refresh the print queue information held in Active Directory.作者: vkill 时间: 2007-1-6 01:48 这个好好看看,觉得不错作者: huahua0919 时间: 2008-10-7 20:44 我要把他学会,谢谢楼主作者: exzzz 时间: 2008-12-15 15:04 你说的这种情况我经常遇到,因为回答比较麻烦,所以我新建了一个帖子,供其它人使用,请参考这里: