Scripting: Mount Printer at Startup Script

So I had to come up with a batch script that would allow the user (in a lab) to select the printer that they wanted to use during that login session.  Pretty much this was placed in the startup folder on a few lab machines and every time someone would login (Deep Freeze Machines) it would ask them to select the printer that they wanted to print to.  It worked pretty well, I hope someone makes use of it.

REM /in = install network printer
REM /n = printer name
REM /y = sets as default
REM
REM Repeat Add printer commands as needed


@ECHO OFF
CLS
:BEGIN

ECHO.
ECHO 1 = Printer 1 2 = Printer 2
ECHO.
Set /p choice="Choose the number of the default printer you desire"
ECHO.
ECHO.
ECHO.
IF not '%choice%'=='' set choice=%choice:~0,1%
IF '%choice%'=='1' GOTO Printer1
IF '%choice%'=='2' GOTO Printer2

ECHO "%choice%" is not valid please try again
ECHO.
GOTO BEGIN

: Printer1
ECHO Installing [BPrinter1] on [PrinterServer]!
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\PrinterServer\Printer1

ECHO Your default printer is [Printer1] on [PrinterServer]
REM Set Default Printer
RunDll32.EXE printui.dll,PrintUIEntry /y /n \\PrinterServer\Printer1
GOTO END

: Printer2
ECHO Installing [Printer2] on [PrinterServer]!
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\PrinterServer\Printer2
ECHO Your default printer is [Printer2] on [PrinterServer]!
REM Set Default Printer
RunDll32.EXE printui.dll,PrintUIEntry /y /n \\PrinterServer\Printer2
GOTO END

:END

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s