Guy’s Scripting Ezine No 16a:  RUNDLL32 PRINTUI.DLL,PrintUIEntry

Contents of Guy’s Scripting Ezine No 16a:
RUNDLL32 PRINTUI.DLL,PrintUIEntry  – Printer Scripts

I love co-operation.  This section illustrates the mutual help capability of the internet.

The initial challenge was to find a method of assigning a printer to a computer rather than a user.  What we wanted was a logon script that would create a printer no matter who logged on.

The basic command is:  RUNDLL32 PRINTUI.DLL,PrintUIEntry

Here are three useful commands kindly sent in by Pete Roper.

1) This installs printer quietly

rundll32 printui.dll,PrintUIEntry /in /q /n\\servername\printername

2) This deletes the networked printer from the machine being logged onto, and does so quietly.
rundll32 printui.dll,PrintUIEntry /dn /q /n\\servename\printername

3) This Sets the default printer

rundll32 printui.dll,PrintUIEntry /y /n\\servername\printername

Guy Recommends: The Free IP Address Tracker (IPAT) IP Tracker

Calculating IP Address ranges is a black art, which many network managers solve by creating custom Excel spreadsheets.  IPAT cracks this problem of allocating IP addresses in networks in two ways:

For Mr Organized there is a nifty subnet calculator, you enter the network address and the subnet mask, then IPAT works out the usable addresses and their ranges. 

For Mr Lazy IPAT discovers and then displays the IP addresses of existing computers. Download the Free IP Address Tracker

Randy Schuman kindly sent in this script.

Warning this script will need adjustment for your environment. For example edit the set pserver = CLTLBXPRN

Warning this script is viscous and will delete all your mapped printers.


@echo off


set pserver=CLTLBXPRN

echo Remove All Network Printers…….

con2prt /f

echo Show All Available Printers From %pserver%…….

net view %pserver%

set /p pname= Enter Printer Name:

rundll32 printui.dll,PrintUIEntry /in /n\\%pserver%\%pname% /q

set pserver=

set pname=



Here is a little research that I undertook.

1) Check that  RUNDLL32 PRINTUI.DLL,PrintUIEntry /? works on your machine, I mention this as it only seems to work on Windows 2003, XP and Windows 2000 machines.

2) Amongst the zillions of switches it seemed that:  /in
– add network printer connection, was the most promising, however I could not get it to work.

3) /y /n Worked to set the default printer.  /y /n "Printer Name"

4) /ge /c \\machine also worked.

That is as far as I got, tantalizing and frustrating.

Here are my original sources of information: