Microsoft KB Archive/314486

= How to add printers with no user interaction in Windows XP =

Article ID: 314486

Article Last Modified on 12/6/2005

-

APPLIES TO


 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Professional

-



This article was previously published under Q314486





For a Microsoft Windows 2000 version of this article, see 189105.



SUMMARY
Windows XP permits you to install a printer from the command line. This is particularly useful when you use a logon script or a scheduled event to add or remove a printer from a group of users.

Although Microsoft Windows NT 4.0 contains tools such as Con2prt.exe, Con2prt.exe permits you to add or delete only network printers. You can modify and delete local printers by using Windows XP. The result is that an administrator can control all aspects of a user's ability to print by requiring users to run a batch file or logon script.

Note If you use this command in a logon script or a client-based batch file, the client computer must be running Windows XP or Microsoft Windows 2000. Because the logon script runs on the client computer, a Windows NT 4.0 client cannot process the command.

Additionally, 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 install from the actual computer.



MORE INFORMATION
The following examples list the most typical uses for the Printer User Interface (PrintUIEntry) command.

Note This command runs only on a Windows XP or Windows 2000-based computer; and it can be used only to install a printer on, or remove a printer from, a Windows XP, Windows 2000, or Windows NT 4.0-based server or workstation.

The following 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 &quot;AGFA-AccuSet v52.3&quot; /h &quot;Intel&quot; /v &quot;Windows 2000&quot; /f %windir%\inf\ntprint.inf

rundll32 printui.dll,PrintUIEntry /if /b &quot;Test Printer&quot; /c\\SERVER /f &quot;%windir%\inf\ntprint.inf&quot; /r &quot;lpt1:&quot; /m &quot;AGFA-AccuSet v52.3&quot; The following example deletes an Agfa printer on a computer named SERVER: rundll32 printui.dll,PrintUIEntry /dl /n &quot;Test Printer&quot; /c\\SERVER For more information about the available switches, type /? after the command.

Additionally, type the following at a command prompt: rundll32 printui.dll,PrintUIEntry /? The preceding command displays the full list of usage switches, with extensive examples for using this method.

Note The following sample syntax works correctly as long as the standard TCP/IP ports are created: rundll32 printui.dll,PrintUIEntry /if /b &quot;Test Printer&quot; /f %windir%\inf\ntprint.inf /r &quot;IP_157.57.50.98&quot; /m &quot;HP Laserjet 4000 Series PCL&quot; /Z If you do not enter the printer name correctly, or if you specify a printer that is not connected to the server, standard TCP/IP ports are not created, and you may receive the following error message:

Printer User Interface

Printer rundll command failed.

Command: /if /b &quot;Test Printer&quot; /f %windir%\inf\ntprint.inf /r &quot;IP_157.57.50.98&quot; /m &quot;HP Laserjet 4000 Series PCL&quot; /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.

Sample of How to Add an IPP Printer
rundll32 printui.dll,PrintUIEntry /b &quot; &quot; /x /n &quot; &quot; /if /f %windir%\inf\ntprint.inf /r &quot;http:// /printers/ /.printer&quot; /m &quot;HP Laserjet 4000 Series PCL&quot;

Note The /x switch is not documented with /?. The /x switch expects /n even though it is not used. Also, you may be using a printer other than the HP Laserjet 4000 Series PCL. The /x flag treats the install as a “Web point and print.” This flag indicates that the printer is a masquerading (masq) printer. A masq printer is partly local printer and partly a network printer. A masq printer receives rich notifications from the remote print server. Without the /x option, the printer is a local printer with a redirected port. It works fine, but it has very limited notifications.

The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Additional query words: push install unattended user interaction print ntprint scripts automated automatic automatically

Keywords: kberrmsg kbinfo kbprint KB314486

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.