Here is how to add a Printer to a Windows XP System from the Command Line.
Here is what is needed
- IP address of the Printer
- Printer Name (your choice)
- Port Name (Your choice)
- Driver Location (can be a mapped drive)
- Name of the Printer, based on the manufacturer(This must be exact)
For this example, I use the following values
- IP_ 192.168.1.25
- “\fs1PublicIT_StuffDriversPrintersHP 4200 Driverhpc4200c.INF”
- “HP LaserJet 4200 PCL 6”
Now here is the magic.
cscript “c:windowssystem32prnport.vbs” -a -r VIP_ 192.168.1.25 -h 192.168.1.25 -o raw -n 9100
rundll32 printui.dll,PrintUIEntry /if /b “LJ_4200” /f “\fs1PublicIT_StuffDriversPrintersHP 4200 Driverhpc4200c.INF” /r “VIP_172.16.170.21″ /m “HP LaserJet 4200 PCL 6”
The first line creates a local TCP/IP Port. The second Line creates the actual printer
If everything goes fine, the printer should appear in the “Printer Control Panel”