在http://windyma.blog.51cto.com/661702/1967027文章,已做好用戶腳本基礎上
成都創(chuàng)新互聯(lián)是一家專注于成都做網(wǎng)站、成都網(wǎng)站建設、成都外貿(mào)網(wǎng)站建設與策劃設計,岳陽縣網(wǎng)站建設哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設十余年,網(wǎng)設計領域的專業(yè)建站公司;建站業(yè)務涵蓋:岳陽縣等地區(qū)。岳陽縣做網(wǎng)站價格咨詢:13518219792
在腳本文件kixtart.kix里添加如下內(nèi)容:
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添加打印機的腳本已經(jīng)完成,但還會有一個問題就是,當windows系統(tǒng)從未安裝過上面打印機驅動時,一般AD用戶是無權限安裝的,windows7電腦會彈一個框出來要求輸入有權限的用戶名和密碼進行安裝,但XP的電腦則直安裝不成功。
所以我們得事先幫讓計算機自動安裝驅動,我們在域針對計算機對像添加一個組策略,組策略的計算機配置---策略---windows設置----腳本(啟動/關機)---啟動項 添加一個printerdriver.cmd文件,內(nèi)容如下(根據(jù)不同系統(tǒng)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