A frequent problem that many people, including me, run into is the necessity to add network printer connections to every user's profile on a machine. Without some magic, network printer connections are per-user. Fortunately, Microsoft has supplied a cryptic API which can be called from the commandline to complete this task.

The entrypoint is PrintUIEntry in printui.dll. Conveniently, this API supplies some graphical help if we run rundll32 printui.dll,PrintUIEntry /? from the command line. There's a whole wad of switches you can specify, but, I'm only going to cover a few of them, as they're the ones necessary for the task at hand.

First and foremost, you'll need admin level rights - a startup script is a good place to run these commands on your machines. At Payton, we use something like this to add the Printer in Room306 on server “PrintServer1“ to a workstation:

rundll32 printui.dll,PrintUIEntry /q /ga /n \\PrintServer1\Room306

There are three switches of interest here:

/q - quiet mode, don't prompt
/ga - add the per machine connection
/n - the UNC path to the printer

In order to make this all work, I string a whole bunch of these commands together, one line for each printer in the school, and then I run them in a startup script. One issue that you'll come across is that these commands cannot be run again once you've added the printer. So, the cheesy solution I've been using is to use the FileSystemObject to create a marker file on C, and then, before I run the commands, use the FSO to check for this file.

Keep in mind, there are a variety of other switches, including ones to delete printers, create per-user connections, etc. Run the API with the /? switch to get a nice little listing.