按:这个脚本是本人写的基于我现在工作的系统网络环境所做的,主要用意是:在一个非Windows服务器管理的网络环境中,提供一种方便的工具,来安装本地的TCP/IP打印机,以方便管理员对打印机的管理。他可以根据计算机的分组信息(分组可以是根据办公室位置来区分,因为打印机都是于位置和权限有关的)以及权限,来安装打印机,这样不同的人员在本台电脑上登录,可以存取到最近的可以打印的打印机,而不是远在其它地方的打印机。

下面是我编写的英文版本的使用说明初稿,还没有在我公司内部发布,先放在我的blog里面。等我有时间再来翻译过来。

Name: SetupIPPrinter (set up Local TCP/IP printer)

Created: May 14, 2010

Updated: Dec 12, 2010

Description:

This program set up TCP/IP printer on a local PC for all users who logged in.

It is used on the following 3 situation but not limited:

School has no server.

School has a Mac server.

School has a PC server, but some AD user groups have to use local TCP/IP printer.

Introduction:

In a PC server school, student printing is managed on server and teachers can put network printer connection easily too. In a none-PC server school, school tech may have to set up TCP/IP printer on each PC for teachers and/or students manually for now. Doing this manual setup is a time consuming task, especially for a number of computers. The purpose of this program is to fill the gap to provide a simple and easy way for school tech to set up printer on PCs.

On a PC server, we manage menus$ share and put a printer list file in "location" folders which is defined in computers' Location field on AD. This program does the similar way and provides more options.

Printer Configuration:

Setup a local printer is different from a network printer connection, it asks for

model, driver, TCP/IP port, and others. So we must define each printer configuration first. All printer configuration information is stored in a file called PrinterConfig.ini file.

Note : if you put /c option in command line, this file name will be changed, for example, /c 212, the file name will be 212_PrinterConfig.ini

Define a Printer Configuration file:

This file is a standard DOS text file. Each line defines one and only one printer. Each line has the following format:

Permission, PrinterName, IP, DriverInfFile, PrinterModel, Location, Comment

A comma separates each field. The maximum number of printers is 500.

Lines starting with # are comments. Spaces before and behind each field will be ignored.

Specification of each field:

Permission : either A or S

1.     A = All users can print

2.     S = Staff only can print

PrinterName :

The printer name shows in the Printers and Faxes list in XP.

IP :

A valid IP address or the Printer name which is defined in DNS.

Driver's Inf File :

The UNC name of a printer driver INF file, it must be in the driver path.

If this field="", then system will not install any driver, it assumes

The driver exists in system printer cab.

Printer Model :

The printer model driver name. This name is listed on printer driver list.

Locations :

Optional, the printer location in the printer Property's Location field.

Comment :

Optional, the printer comment in the printer Property's Comments field.

For example:

A, P241LAB1, 10.23.66.2,  ./HPUPD/hpcu109c.inf, HP Universal Printing PCL 6, Computer Lab, For All students and Staff

It defines a "P241LAB1" printer, whose IP address is 10.23.66.2, the printer driver INF file is in a subfolder "HPUPD", of current folder,   file name is hpcu109c.inf, the printer model driver name is "HP Universal Printing PCL 6", the location is "Computer Lab", the comment is "For All students and Staff", and all users(staff and students) can print to it.

Location List file:

What printers are set up on a computer is determined by it’s location. A computer’s location can be defined in AD, or in a Location List file. A location List file is a standard DOS text file and each line defines a computer’s location. The file name is Locations.ini .

Note : if you put /c option in command line, this file name will be changed, for example, /c 212, the file name will be 212_Locations.ini

The format of each line is:

Location, ComputerName

A comma separates each field. Lines starting with # are comments. Spaces before and behind each field will be ignored.

Location:

The location name. this name is a location file name.

ComputerName:

The computer name.

For example:

Office, W999-001

Library, W999-004

Lab, w999-201

What it does?

Location Printer List file:

Each location of a computer can have a list of printers and a default printer.

This file’s format is simple. It lists all the printers that this location’s computers can access. The file name is the location name, for example, location Library has a location printer list file named “Library.txt”.

Each printer occupies one line. The printer name must be same as the one in Printer Configuration file. The first printer on the list is the default printer. Spaces before and behind will be ignored.

There’s a special Location List file, Default.txt . All the computers which doesn’t have a location defined, will get printer list from this file.

Example of Location Printer list file:

P212OFF1

P212LIB1

P212LAB1

Run it, SetupIPPrinter.vbs

How it works?

It gets computer name, find the computer’s location from Locations.ini file, for example, lab; and make the location name as file name to open the location printer list file, lab.txt, and read the printer list, for each printer, read printer configuration PrinterConfig.ini , and then set it up.

Usage:

cscript PrinterSetup.vbs [options….]

/c: define school code, this code is used for configuration files name only.

/l [0|1|2]: log message level.

Log Level:

0: only system info

1: Error only

2: Error and warning messages

3: All messages

/d: Delete all TCP/IP ports and printers first.

/p: the full path of configuration files. Default=the same as script’s.

/?: online help.

Please put SetACL.exe file with this script.

Put all together:

Best practice:

1. Collect all school computers name with locations.

2. Collect all printers and what locations computer will printer to it.

3. Define a location name for each group of computers which have same printers

to print.

4. Create printer configuration file, named "PrinterConfig.ini ", and add printers.

5. Update computer location in AD, or add all computers location to "Locations.ini " file, and remember which method you chose. File ot AD?

6. Decide where to save these configuration files, ie. *.txt and *.ini files:

On school server share folder? write down the share folder's URL.

On a folder on each location machine? write down the location.

Save these files to the destination folder.

7. Test it with debug log level to 2 or 3. Check the info messages. Go back to make changes if program reports warnings or errors.

8. Set log level to 0 or 1 when you decide to run program in product environment.

9. Deploy it in WDS or run it on a computer.

A complete example:

PrinterConfig.ini file:

S, P999CPY1, 10.45.66.9,  ./HPUPD/hpcu109c.inf,       HP Universal Printing PCL 6,      WorkRoom near Office, For All Staff only

S, P999MFP1, 10.45.66.10, ./Ricoh/oemsetup.inf,      PCL6 Driver for Universal Print,  Copier Room,          For All Staff only

S, P999OFF1, 10.45.66.2,  ./HPUPD/hpcu109c.inf,       HP Universal Printing PCL 6,      WorkRoom near Office, For All Staff only

A, P999LAB1, 10.45.66.5,  ./HPUPD/hpcu109c.inf,       HP Universal Printing PCL 6,      WorkRoom near Office, For All Staff only

Locations.ini file:

Office, W999-001

Office, W999-002

Lab, w999-101

Room01, W999-501

Lib, w999-690

Office.txt

P99OFF1

P999CPY1

P999MFP1

Default.txt

P999LAB1

P999MFP1

P999CPY1

Put all these files in a folder, c:/IPPrinter.

Run the program command line:

cscript c:/IPPrinter/setupIPPrinter.vbs /l 3 /d

原文链接: http://blog.csdn.net/afatgoat/article/details/6073216

转载于:https://my.oschina.net/junwong/blog/46607

Windows: 根据分组的本地TCP/IP打印机的安装(1)相关推荐

  1. xp系统远程计算机需要网络打印机驱动,WinXP手动添加TCP/IP端口及安装打印机驱动(系统向导安装,不需要任何软件)...

    打印机驱动安装,一般情况下我们都建议客人使用"打印机驱动安装助手"安装,但有些电脑运行软件出错:或者是有些客人顾虑软件安全性:或者是服务器版本太老无法支持,所以做这个教程,脱离任何 ...

  2. ISA2004 发布内部TCP/IP打印机

    在一些特殊场合,我们的办事处或合作伙伴可能需要使用我们内网的打印机打印,怎样才能提供打印机的共享服务呢?下面我们一起来探讨一下,这里我以192.168.50.12这台网络打印机为例,进行说明.具体步骤 ...

  3. ip设置 kali 重置_在 Windows 系统中如何重置 TCP/IP 协议堆栈修复网络连接问题

    Internet 在 TCP/IP 协议上工作,如果 TCP/IP 协议堆栈在 Windows 或任何其他操作系统(例如 Linux 或 MacOS)中无法正常工作,则您的 Internet 连接会出 ...

  4. 使用批处理批量安装TCP/ip打印机

    一般来说,安装基于TCP/IP端口的打印机都需要经过两个步骤,第一步是添加TCP/IP端口,第二步是安装打印机驱动程序.    既然要实现无需人工参与批量部署,就肯定离不开脚本或者命令行.好在这些WI ...

  5. Windows NT和2000的TCP/IP设置

    http://www.xhit.cn/html/net/xieyi/jichu/20070702/55169.html TCP/IP是一个广泛使用的广域网协议,在NT和2000系统中,它的一些参数会由 ...

  6. Windows Server 2008之三设置TCP/IP

    Windows Server 2008Windows Server 2008作为网络操作系统的联网肯定是必须的,那么,我们就要考虑如何在Windows Server 2008环境设置网络连接的环境,比 ...

  7. 未配置TCP/IP,必须安装并启用网络适配器

    刚遇到的,想想都头痛的.下面我们一起解决下吧.我上网.找朋友问了好玖,答案也是多多的. 首先看看是怎样的问题 1.  360的断网急救箱 2.  看看这个网址写的:       http://jing ...

  8. win10系统打印服务器,Win10手动添加TCP/IP端口及安装打印机驱动(系统向导安装,不需要任何软件)...

    1.00) 在电脑上添加您的打印机. 1.01) 点击屏幕左下角的小圆圈–输入"-设备和打印机"– 然后点击上面的 设备和打印机. 1.02) 点击"添加打印机" ...

  9. 设置计算机名与TCP/IP协议、设置Windows防火墙。

    一.设置计算机名与TCP/IP协议 1更改计算机名与工作组名. 进入"服务器管理界面",打开"服务器管理仪表盘".2单击窗口左侧"本地服务器" ...

最新文章

  1. android调节声音大小
  2. python接口自动化4-绕过验证码登录(cookie)
  3. hdu 1102 pku 2421 解题报告
  4. 仿小黄车android定位,小黄车ofo是怎么实现自行车定位功能的?
  5. 【摘录】MTK按键扫描原理及相关代码
  6. Numpy 之shape manipulation
  7. 《Python编程从入门到实践》记录之第6章 字典操作知识总结——字典遍历、字典嵌套等(思维导图)
  8. DB2数据库常用命令及查询
  9. freemaker eclipse 插件下载
  10. AJax 遍历json对象数组 和Jstl遍历以及json解决日期转换
  11. 淘宝天猫返利,是怎么一种运作模式?
  12. java web批量下载
  13. 介绍java 8 的 Period 和 Duration 类
  14. java和python哪个运行速度快_python和java学哪个比较简单点
  15. 恭喜惠州市靖元五金塑胶制品设计有限公司与华信环球再次达成合作!
  16. STM32学习手记5 BKP后备寄存器、RTC和中断
  17. idea风格ui java_IDEA界面太丑??尝试一下这几个风格
  18. 使用FTPClient封装FtpUtil
  19. 车载前置摄像头学习笔记 ———— 摄像头输出数据格式(JPEG)
  20. win10网络图标变成地球加禁止符号但能上网解决办法

热门文章

  1. turtle海龟画板
  2. 【十二】Python全栈之路--推导式_生成器
  3. css强制换行和禁止换行
  4. 学习完美方块小游戏(cocos creator)
  5. 【uni-app】App实现二维码分享图合成(支持单张或多张)
  6. adb通过wifi连接真机
  7. 实例示范( 泰坦尼克沉船数据分析之一)
  8. 工作之余,请IT人员开怀大笑吧
  9. 未发表的2015年年终总结
  10. jenkins网页打不开问题解决方法