Get the App
SLTechnology News&Howtos  ›  Servers  › 

The third use of AD script kixtart (add windows shared printer)

Shulou Source: shulou.com Published: 2022-06-02 18:04:19 10月30日 Update

Based on the http://windyma.blog.51cto.com/661702/1967027 article, user scripts have been done.

Add the following to the script file kixtart.kix:

IF INGROUP ("Color_Printer") If AddPrinterConnection ("\\ zsprinter.nccn.int\ NEO-Color-Printer") = 0? "Added NEO-Color-Printer connection...." When EndifEndif; adds a NEO-Mono-Printer printer, it is set to the default 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...." When EndifEndif; adds another printer for different printer users, it is set to the default printer 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 EndifEndif

To this kix add printer script has been completed, but there will be a problem is, when the windows system has never installed the above printer driver, the general AD users do not have the authority to install, windows7 computer will pop up a box asking for permission to enter the user name and password to install, but the XP computer is directly installed unsuccessfully.

So we have to help the computer install the driver automatically in advance. We add a group policy for the computer object in the domain, and the computer configuration of the group policy-Policy-windows setting-script (startup / shutdown)-- adds a printerdriver.cmd file to the startup item, as follows (add different drivers according to different systems 32-bit or 64-bit):

Echo offgoto% PROCESSOR_ARCHITECTURE%:x86IF 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:AMD64IF 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): endexit

Tags: Printer script user different policy computer driver content at the same time file permissions computer system success never basic password that is article user name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Tech Info OPPO Reno Huawei macOS