Installing a Network Printer via Command Line

Recently I had to install a printer on a lot of workstations in a short amount of time. I came up with this script to make things a lot faster. Below the script breakdown is a link to the script to copy/paste. I deployed it via our remote management software (GFI Max), but it could be used with PsExec, group policy, or a logon script as well.

All of the VBS files referenced are located at “C:\Windows\system32\Printing_Admin_Scripts\” on all Win7 and XP machines.

Script Breakdown
Script Breakdown

Here is a link to the script in plaintext.

@echo off
REM This line removes the port if its already added
cscript "\\master-server\data\test\scripts\Prnport.vbs" -d -r IP_10.0.0.205

REM This line removes the printer if its already added
cscript "\\master-server\data\test\scripts\Prnmngr.vbs" -d -p "Brother Color Laser Printer"

REM This line adds the port
cscript "\\master-server\data\test\scripts\Prnport.vbs" -a -r IP_10.0.0.205 -h 10.0.0.205 -o raw -n 9100

REM This line adds the printer driver
cscript "\\master-server\data\test\scripts\Prndrvr.vbs" -a -m "Brother MFC-9970CDW Printer" -i \\master-server\data\test\drivers\32\brpoc10a.inf -h \\master-server\data\test\drivers\32

REM this line adds the printer and specifies which driver/port to use
cscript "\\master-server\data\test\scripts\Prnmngr.vbs" -a -p "Brother Color Laser Printer" -m "Brother MFC-9970CDW Printer" -r IP_10.0.0.205