Windows Logon Scripts - Create Multiple Printers
Introduction to Create Multiple Printers
Once you have discovered how to create one network printer, it is relatively straightforward to add a second or third printer. Apply techniques you acquire in one area to another area. For example, once you learn how to map multiple network drives, then apply that knowledge to create multiple printers, or vica versa.
Topics for Creating Multiple Printers
Our mission is to map not one, but two (or more) printers. As VBScripts go, this is a straightforward script and an ideal vehicle for beginners to learn the structure of this language. Nevertheless, there are instructive pointers for all levels of ability. I have divided our mission into three stages, 1) Map one printer, 2) Map multiple printers, 3) Set the default printer.
You don't need Active Directory, what you do need is a machine with two shared printers. Alternatively use two print servers. Be flexible and if necessary cheat by creating 'fantasy' printers with the Add Printer Wizard.
' Printer1.vbs - Windows Logon Script.
VBS Learning Points
Note 1: AddWindowsPrinterConnection is the key command. Providing the client is XP or Windows 2000, you only need one argument, the UNC path to the network printer. In this
example, the printer is controlled by the variable strUNCPrinter1. However, it is possible to use the UNC path directly, without creating a variable:
Note 2: To help with the line numbers, and to color code your commands get OnScript (free download).
Here in Stage Two is where we fulfil our mission and add more printers. Let us build on the success of Stage One and add an extra command, which maps a second printer.
' PrintersTwo.vbs - Windows Logon Script.
Note 1: You only need one object: objNetwork. The secret is to recycle this object by AddWindowsPrinterConnection to two different strUNCPrinter variables.
Note 2: It is straightforward to add a third printer by introducing another strUNCPrinterX and then inserting a matching objNetwork.AddWindowsPrinterConnection strUNCPrinterX statement.
Note 3: See more on Windows 8 printer troubleshooting.
I like the Permissions Monitor because it enables me to see quickly WHO has permissions to do WHAT. When you launch this tool it analyzes a users effective NTFS permissions for a specific file or folder, takes into account network share access, then displays the results in a nifty desktop dashboard!
Think of all the frustration that this free utility saves when you are troubleshooting authorization problems for users access to a resource. Give this permissions monitor a try - it's free!
Once you add a second or third printer, it makes sense to set the default printer rather than leave it to chance. In this example I have set the default printer to strUNCPrinter1, however, you may wish to amend this value.
' PrinterSetDefault.vbs - Windows Logon Script.
Note 1: You may have been wondering why I introduced strLocal, but not used this variable. The answer is that I have left a little work for you, a) Change the value of strLocal
b) Then amend this line :
Mapping two printers is not difficult. Use this as an opportunity to apply knowledge from others areas, for example mapping multiple network drives. Once you have created two or more printers, then it makes sense to control which printer is the default.
See more printer logon scripts examples