Saved for later reference

online repository of stuff I had to google for hours to figure out – and random snippets of code

Script to add a network printer automatically in Windows

Tags: , , , , ,

I recently had to replace a defective printer with a similar model, but different enough to need a new driver. This meant it would have a new name on the print server, and I had to figure out a way to replace the installed printer on each computer quickly. After some searching, I ended up with the following script:

@echo off
set OLDPRINTER="\\printserver\Xerox Phaser 8560N"
set NEWPRINTER="\\printserver\Xerox Phaser 8560DN PS"
rundll32 printui.dll,PrintUIEntry /q /dn /n%OLDPRINTER%
rundll32 printui.dll,PrintUIEntry /in /n%NEWPRINTER% /q
rundll32 printui.dll,PrintUIEntry /y /n%NEWPRINTER%

The first rundll32 line quietly (/q) deletes (/dn) the printer named (/n) %OLDPRINTER%, while the second line installs (/in) the new printer %NEWPRINTER%, and the final line sets the new printer as default (/y)


© 2009 Saved for later reference. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.