How to Add a Network Printer for all Users on a Computer

Windows 2000, XP, 2003, Vista, and 2008 Operating Systems have the capability to add a Network Printer so that it is automatically available to any user that logs on that computer. Unfortunately, the Add Printer wizard does not provide that capability. The Add Printer Wizard can only add a Network Printer for the user currently logged on. To add a printer globally (for all users) on a computer, you require the PrintUIEntry function of printui.dll.

These functions can be utilized either on the same computer that printui.dll is running on or remotely. The Rundll32 command can be used to execute PrintUIEntry function of printui.dll.

PrintUIEntry /ga Adds a printer

PrintUIEntry /gd Deletes a printer

A printer added using the /ga function will not show up until the print spooler has been restarted or the user logs out and then logs back into the computer.

For scripting purposes, the print spooler can be started using these commands:
sc \\targetcomputername stop spooler
sc \\targetcomputername start spooler

To add a printer and restart the print spooler:
rundll32 printui.dll,PrintUIEntry /ga /n\\printerservername\printersharename
start /wait sc stop spooler
start /wait sc start spooler

rundll32 printui.dll,PrintUIEntry switches:

/c specifies the computer which is to be the target of the requested action. If /c is not specified, the local computer is assumed.

/n specifies which network printer is to be, in this case, added using the printer's UNC name (\\servername\printersharename).

/? is understood by PrintUIEntry to be a request for its Help information, which is displayed in a separate window.

start /wait command runs the command (e.g. sc), then waits until the command actually terminates.


Download PRINTUI.DLL User's Guide from