在http://windyma.blog.51cto.com/661702/1967027文章,已做好用户脚本基础上
在脚本文件kixtart.kix里添加如下内容:
---------------------------------------
IF INGROUP ("Color_Printer")
If AddPrinterConnection ("\\zsprinter.nccn.int\NEO-Color-Printer") = 0
? "Added NEO-Color-Printer connection...."
Endif
Endif
;添加NEO-Mono-Printer打印机的同时设置为默认打印机
If AddPrinterConnection ("\\zsprinter.nccn.int\NEO-Mono-Printer") = 0
? "Added NEO-Mono-Printer connection...."
If SetDefaultPrinter ("\\zsprinter.nccn.int\NEO-Mono-Printer") = 0
? "Set default printer to NEO-Mono-Printer...."
Endif
Endif
;为不同打印机用户添加另外一台打印机的同时设置为默认打印机
IF INGROUP ("Small_Printer")
If AddPrinterConnection ("\\zsprinter.nccn.int\Small-Printer") = 0
? "Added printer to Small-Printer...."
If SetDefaultPrinter ("\\zsprinter.nccn.int\Small-Printer") = 0
? "Set default printer to Small-Printer...."
Endif
Endif
Endif
到此针对 kix添加打印机的脚本已经完成,但还会有一个问题就是,当windows系统从未安装过上面打印机驱动时,一般AD用户是无权限安装的,windows7电脑会弹一个框出来要求输入有权限的用户名和密码进行安装,但XP的电脑则直安装不成功。
所以我们得事先帮让计算机自动安装驱动,我们在域针对计算机对像添加一个组策略,组策略的计算机配置---策略---windows设置----脚本(启动/关机)---启动项 添加一个printerdriver.cmd文件,内容如下(根据不同系统32位或64位添加不同驱动):
--------------------------------------------
@echo off
goto %PROCESSOR_ARCHITECTURE%
:x86
IF NOT EXIST "C:\Windows\system32\spool\DRIVERS\W32X86\3\KOAYQJAT.dll" (rundll32 printui.dll,PrintUIEntry /ia /m "Generic 36C-6SeriesPCL" /f \\zsprinter.nccn.int\Driver\ADC286_Printer\Win_x86\KOAYQJA_.INF /u)
IF NOT EXIST "C:\Windows\System32\spool\drivers\W32X86\3\KOAYXJAG.DLL" (rundll32 printui.dll,PrintUIEntry /ia /m "Generic 42BW-4SeriesPCL" /f \\zsprinter.nccn.int\Driver\AD289_Printer\Win_x86\KOAYXJA_.INF /u)
IF NOT EXIST "C:\Windows\system32\spool\DRIVERS\W32X86\3\GWP.DLL" (rundll32 printui.dll,PrintUIEntry /ia /m "Generic 21BW-3 PCL" /f \\zsprinter.nccn.int\Driver\AD219_Printer\32\GWP.inf /u)
goto end
:AMD64
IF NOT EXIST "C:\Windows\system32\spool\DRIVERS\x64\3\KOAYQJAT.dll" (rundll32 printui.dll,PrintUIEntry /ia /m "Generic 36C-6SeriesPCL" /f \\zsprinter.nccn.int\Driver\ADC286_Printer\Win_x64\KOAYQJA_.INF /u)
IF NOT EXIST "C:\Windows\system32\spool\DRIVERS\x64\3\KOAYXJAG.DLL" (rundll32 printui.dll,PrintUIEntry /ia /m "Generic 42BW-4SeriesPCL" /f \\zsprinter.nccn.int\Driver\AD289_Printer\Win_x64\KOAYXJA_.INF /u)
IF NOT EXIST "C:\Windows\System32\spool\drivers\x64\3\GWP.DLL" (rundll32 printui.dll,PrintUIEntry /ia /m "Generic 21BW-3 PCL" /f \\zsprinter.nccn.int\Driver\AD219_Printer\64\GWP.inf /u)
:end
exit