Adding a network printer for all Users
There is NO option in the Add Printer wizard to add a network printer for all users of a computer, but the capability to do so does exists in Windows NT, 2000 and XP.
The PrintUIEntry function of printui.dll has options for performing most printer management functions. It can perform these functions either on the same computer that printui.dll is running on or on another computer (i.e remotely). The general purpose rundll32 command can be used to execute PrintUIEntry function of printui.dll.
Some things to keep in mind:
1. The function for adding a printer globally is /ga. Globally in this context means that the action applies to all and any users that happen to logon at the target computer.
2. The corresponding function for deleting a printer globally is /gd. If you attempt to delete a global printer by using the Delete function in the printer's context menu, it will appear to delete, but will reappear when the Print Spooler service is restarted.
3. Only printers previously added using the /ga function can be deleted using /gd.
4. You have to have administrative rights and permissions on the target computer to use these functions.
5. If a printer is added remotely using the /ga function, it will not appear to the user until the Print Spooler service is restarted or the user next logs on. You can restart the print spooler remotely using these commands:
sc \\targetcomputername stop spooler
sc \\targetcomputername start spooler
Like any other commands these commands can be used inside a command file, such as apwp (see below).
Here's a way of "installing" network printers on workstations so that they are available to all users (remotely).
Paste the following into a .cmd file (e.g. apwp.cmd)
rundll32 printui.dll,PrintUIEntry /ga /c\\%1 /n\\%2
sc \\%1 stop spooler
sc \\%1 start spooler
Then, at a command prompt key:
apwp targetcomputername printservername\printersharename
For example to install the printer \\pserver\p1 on the workstation abc:
apwp abc pserver\p1
To find out more about the rundll32 printui.dll,PrintUIEntry command, key (case sensitive):
rundll32 printui.dll,PrintUIEntry /?
Here's some details:
/c specifies the computer which is to be the target of the requested action.
If /c is not specified, the local computer is assumed. In other words, the /c option allows you to do printer management things on other computers without actually physically being there (i.e. remotely).
/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.
|