Tuesday, October 30, 2007

Adding network printer for all users on a computer

How do I add a network printer for all users on a computer?
1.1. When a user, even an administrator, adds a network printer using the Add Printer wizard, the printer is only added for that particular user. If another user logs on at that computer, the network printer is not available for them until they add it.

1.2. A network printer is much like a mapped network drive in the sense that it is just a reference (pointer) to a printer share on another computer. These kinds of things are specific to the user that creates (adds) them.

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 exist in Windows 2000, 2003 and XP.

1.3. Here are the steps to add a printer for all users on a computer. Note that this process adds a printer permanently, just as does the Add Printer wizard. There is not much point in placing these commands in logon or startup script because that will result in multiple instances of the printer on each computer, one for each time a user logs on or the computer is restarted.
However, these commands can be used in command files (.cmd files) or scripts, which makes it relatively simple and quick to add multiple printers to one computer, the same printer to multiple computers, or a mixture of both.
  1. Logon at the computer with an administrative user account
  • open a Command Prompt window
  • type the command:

rundll32 printui.dll,PrintUIEntry /ga /n\\UNC-path-to-the-printer

For example, if the printer’s name is P1 and it is defined on the computer C1 (i.e. the Print Server is called C1), type exactly:

rundll32 printui.dll,PrintUIEntry /ga /n\\C1\P1

1.4. If you want to, you can add a network printer remotely -- that is, on another computer -- by including the /c parameter.

For example, if you want to add the printer \\C1\P1 to the computer called CC while logged on at another computer, use this command:

rundll32 printui.dll,PrintUIEntry /ga /c\\CC /n\\C1\P1

The printer added this way won't be useable (e.g. won't show up in the list of available printers) until the Print Spooler service is restarted or a user logs on.

You can restart the Print Spooler by typing these commands in the Command Prompt window:

net stop spooler
net start spooler

You can restart the print spooler on another computer by using these commands:

sc \\ComputerName stop spooler
sc \\ComputerName start spooler

You can also use the Computer Management console to restart the print spooler on the other computer:

  1. click Start, Administrative Tools, Computer Management
  2. In the left pane, right click on the root of the tree (Computer Management (Local)) and select Connect to another computer
  3. Type the name of the computer (e.g. for the above example this would be CC) and click OK
  4. In the left pane, click the + sign beside Services and Applications
  5. click Service
  6. In the right pane, right click on Print Spooler and select Restart

Another alternative is force the other computer to restart using the command:

Shutdown -r -m \\computername

e.g.
shutdown -r -m \\cc

No comments: