For a Microsoft Windows XP version of this article, see 314486.
Windows 2000 and Windows Server 2003 provide the ability to install a printer using a command line. This is particularly useful when you add or remove a printer from a group of users using a login script or a scheduled event.
Although Microsoft Windows NT 4.0 Zero Administration Kit (ZAK) contains tools such as Con2prt.exe, the Con2prt.exe tool provides the ability to add or delete only network printers. You can also modify and delete local printers using Windows 2000. The result is that an administrator can control all aspects of a user's ability to print by having users run a batch file or logon script.
NOTE: Using this command in a login script or a client-launched batch file requires the client computer to be running Windows 2000 or Windows Server 2003. Because the login script runs on the client computer, a Windows NT 4.0 client is unable to process the command.
In addition, these commands can be run from an administrator's workstation or from a server so that the printers are push-installed to the client computers without having to go to the actual computer.
The following examples list the most typical uses for the command.
NOTE: This command only runs on a Windows 2000-based or Windows Server 2003-based computer against a Windows 2000, Windows Server 2003, or a Windows NT 4.0 server or workstation.
This example adds an Agfa printer driver and creates a logical printer on a computer named SERVER.
NOTE: Both lines can be placed in a batch file or typed after each other at a command prompt. These two lines are wrapped for readability.
rundll32 printui.dll,PrintUIEntry /ia /c\\server /m "AGFA-AccuSet v52.3" /h "Intel" /v "Windows 2000" /f %windir%\inf\ntprint.inf
rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /c\\SERVER /f "%windir%\inf\ntprint.inf" /r "lpt1:" /m "AGFA-AccuSet v52.3"
This example deletes an AGFA printer on a computer named SERVER:
rundll32 printui.dll,PrintUIEntry /dl /n "Test Printer" /c\\SERVER
For more information about the available switches, type
/? after the command.
In addition, at a command prompt, type:
rundll32 printui.dll,PrintUIEntry /? The preceding command displays the entire list of usage switches with extensive examples for using this method.
Additionally, at a command prompt, type
rundll32 printui.dll,PrintUIEntry /Xs /n "printer" ? The preceding command displays additional help for changing printer properties. The following example switches the current print driver to the specified new printer driver (already installed on the server):
rundll32 printui.dll,PrintUIEntry /Xs /n\\SERVER\PRINTERSHARENAME DriverName "Lexmark C752 PS3"
NOTE: The following syntax is an example that works correctly as long as the Standard TCP/IP Ports are created.
rundll32 printui.dll,PrintUIEntry /if /b "NORTH-US-SRTEST-TEST24-BOGUS" /f %windir%\inf\ntprint.inf /r "IP_126.96.36.199" /m "HP Laserjet 4000 Series PCL" /Z
If Standard TCP/IP Ports are not created, the following error dialog box may be experienced:
Printer User Interface
Printer rundll command failed.
Command: /if /b "NORTH-US-SRTEST-TEST24-BOGUS" /f %windir%\inf\ntprint.inf /r "IP_188.8.131.52" /m "HP Laserjet 4000 Series PCL" /Z.
You either entered a printer name that was incorrect or the specified printer is no longer connected to the server. Click Help for more information.