Hello,
What I have: A script that installs network printers with regard to group membership of the current user.
The Problem: Some employees work on many different workstations. Everytime they access a new machine with their user for the first time, they have to run the script (even if another user already ran the script). Otherwise they see no printers. Since the installation requires administrator rights, everytime this happens, someone from the IT department has to type in his credentials.
The intented solution: Deploy the script to this particular group via Group Policy and let it execute exactly one time, when they log into a machine where they did not already run the script.
Perhaps the script itself could be modified, so that GPO deploying wouldnt be necessary.
Here is the Script:
@echo off @ping -n 2 -w 1000 localhost >nul 2>&1 echo Loesche alte Druckereintraege... rundll32 printui.dll,PrintUIEntry /q /dn /n \\data\HP2300 >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n \\data\HP3010 >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n \\data\HP3800 >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n \\file\HP3010 >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n \\file\HP3800 >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n \\file\Kopierer >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n "\\data\HP 2300" >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n "\\data\HP 3010" >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n "\\data\HP 3800" >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n \\data\KONICA_MI >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n \\file\HP4540 >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n \\file\Kyocera >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n "\\ws-sek08\DYMO LabelWriter 450 DUO Label" >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /dn /n "\\ws-sek08\DYMO LabelWriter 450 DUO Tape" >nul 2>&1 echo Alte Eintraege geloescht! REM Syntax "rundll32 printui.dll,PrintUIEntry": /dn = deletes a network printer connection , /in = Connects to a network printer , /y = sets printer as the default printer echo Neue Drucker einbinden... @ping -n 2 -w 1000 localhost >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /in /n \\file\Kyocera /u /w >nul 2>&1 echo [Kyocera ] eingebunden @ping -n 2 -w 1000 localhost >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /in /n \\file\HP3010 >nul 2>&1 echo [HP 3010 ] eingebunden @ping -n 2 -w 1000 localhost >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /in /n \\file\Kopierer >nul 2>&1 echo [Kopierer C203] eingebunden rundll32 printui.dll,PrintUIEntry /y /n \\file\Kyocera >nul 2>&1 call net group /domain sek | findstr /i %USERNAME% >nul 2>&1 if %errorlevel% == 0 ( @ping -n 2 -w 1000 localhost >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /in /n "\\ws-sek08\DYMO LabelWriter 450 DUO Label" /u /w >nul 2>&1 rundll32 printui.dll,PrintUIEntry /q /in /n "\\ws-sek08\DYMO LabelWriter 450 DUO Tape" /u /w >nul 2>&1 echo [Sekretariat ] Label Writer ) call cmd /c "exit 99" REM Und Standarddrucker setzen! call net group /domain sek | findstr /i %USERNAME% >nul 2>&1 if %errorlevel% == 0 ( REM Je nach Benutzergruppe (Sekretariat, Artwor, ...) anderen Standarddrucker werwenden. @ping -n 2 -w 1000 localhost >nul 2>&1 rundll32 printui.dll,PrintUIEntry /y /n \\file\HP3010 >nul 2>&1 echo [Sekretariat ] Standarddrucker HP3010 ) call cmd /c "exit 99" call net group /domain artwor | findstr /i %USERNAME% >nul 2>&1 if %errorlevel% == 0 ( @ping -n 2 -w 1000 localhost >nul 2>&1 rundll32 printui.dll,PrintUIEntry /y /n \\file\Kopierer >nul 2>&1 echo [artwor ] Standarddrucker Kopierer ) call cmd /c "exit 99" pause
Best regards,
zuckerthoben
chn