Script To Auto Install A Local Printer Using Tcp-Ip
Script To Auto Install A Local Printer Using Tcp-Ip
REM creating folders on the remote machine to copy the drivers and printer scrip
ts you'll need to install the printer
REM I chose two folders to keep my drivers and scripts separate to keep it simpl
e, you can use one folder if you REM: wish
md C:\DRIVERS
md C:\SCRIPTS
REM Using xcopy to grab the "2kXPVista" file off of the server which contains th
e .inf and .dll files for the Sharp MX-M623N printer.
REM Most sharp printers have this "2kXPVista" file buried in their driver when y
ou download it from
REM For this particular Sharp MX-M623N printer, our .inf file is "sr0ejenu.inf"
REM If you look in the .inf file for your driver you ll see the model you need, in o
ur case it s "SHARP MX-M623N REM: PCL6"
xcopy "\\SERVER\DRIVER_FOLDER\Sharp\MX-M623N\BF2SP-PCL6PS-1104a-2kxpVista-WHQL\E
nglishA\PCL6\2kXPVista" C:\DRIVERS /I /y /D
REM /I If destination does not exist and copying more than one file, assumes tha
t destination must be a directory.
REM /Y Suppresses prompting to confirm that you want to overwrite an existing de
stination file.
REM /D if you want the file or files to be copied to a directory
REM Win7 built in printer scripts
REM cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prndrvr.vbs (adds pri
nter drivers)
REM Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs (adds pri
nter port)
REM Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs (ties the
name, port, and driver together)
REM I have these three scripts I copy from a server which also work on XP, Vista
, and Win7
xcopy "\\SERVER\FOLDER\Scripts" C:\Scripts /I /Y /D
REM The first Prnmngr.vbs is to delete the printer if you're trying to add a pri
nter with the same name
cscript "C:\Scripts\Prnmngr.vbs" -d -p "PHS - Online"
REM Adds a printer port with name "IP_PRINTERIP" and IP address of "PRINTERIP"
Cscript "C:\Scripts\Prnport.vbs" -a -r IP_PRINTERIP -h PRINTERIP -o raw -n 9100
REM Installs the printer driver, first getting the printer model and .inf file,
then -h for the path to the .dll
Cscript "C:\Scripts\Prndrvr.vbs" -a -m "SHARP MX-M623N PCL6" -i C:\DRIVERS\sr0ej
enu.inf -h C:\DRIVERS
REM Finally giving the printer a name of "PHS - Online", linking the model and p
rinter port
Cscript "C:\Scripts\Prnmngr.vbs" -a -p "PHS - Online" -m "SHARP MX-M623N PCL6" r IP_PRINTERIP
REM Last, deleting the directories
rd C:\SCRIPTS /s /q
rd C:\DRIVERS /s /q
REM I add the pause in just in case it errors, I will be able to see what it is
@pause