Automate local printer installation

Managing local printer on PC is fun but imagine if you are going to deploy 50 to 100+ IP Network Printers such as HP, Lexmark and XeroX. You have to manually add the printer connection and driver to each work station using the wizard tool. This method is time consuming.

Login scripts can automate the addition of printers with no user interaction in windows, because window 2000/xP and Windows Server 2003 provide the ability to install a printer using command line.

First we need to create Standard TCP/IP Ports with regedit

Copy end paste the syntax below and save as CREATE_TCPIP_PORT.REG
Take Note: replace the XX.XX.XX.XX with your network ip printer

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_XX.XX.XX.XX]
"Protocol"=dword:00000001
"Version"=dword:00000001
"HostName"=""
"IPAddress"="XX.XX.XX.XX"
"HWAddress"=""
"PortNumber"=dword:0000238c
"SNMP Community"="public"
"SNMP Enabled"=dword:00000001
"SNMP Index"=dword:00000001

Finally copy end paste the syntax below and save as ADD_PRINTER.BAT

REM # -------------------------------------
REM # Digital Gizmo
REM # -------------------------------------
@Echo Off

REM # Create Standard TCP/IP Ports
regedit /s "\\tsclient\Printer\CREATE_TCPIP_PORT.REG"

REM # Restart the spooler service
net stop spooler
net start spooler

REM # Make sure no duplicate printer exist
rundll32 printui.dll,PrintUIEntry /dl /n "TEST PRINTER" /q

REM # Install the Standard TCP/IP Printer Driver
rundll32 printui.dll,PrintUIEntry /if /b "TEST PRINTER" /f %windir%\inf\ntprint.inf /r "IP_XX.XX.XX.XX" /m "HP Laserjet 8100 Series PS" /z
pause

1 comment:

bry said...
This comment has been removed by the author.