Map Network Printers in Logon Script

You can map your network printers automatically to a user with the help of Logon scripts.

  • Create a .vbs file and give an appropriate name eg:marketing.vbs
  • Place the following code in that file
Option Explicit 
Dim objNetwork, strLocal, strUNCPrinter1, strUNCPrinter2, strUNCPrinter3 
strUNCPrinter1 = "\\server-name\printer-name" 
strUNCPrinter2 = "\\server-name\printer-name" 
strUNCPrinter3 = "\\server-name\printer-name" 
Set objNetwork = CreateObject("WScript.Network") 
objNetwork.AddWindowsPrinterConnection strUNCPrinter1 
objNetwork.AddWindowsPrinterConnection strUNCPrinter2 
objNetwork.AddWindowsPrinterConnection strUNCPrinter3 
objNetwork.SetDefaultPrinter strUNCPrinter1 
WScript.Quit
  1. The above code will intialize three printers(strUNCPrinter1, strUNCPrinter2, strUNCPrinter3
    ) and set the default printer as strUNCPrinter1
  2. You need to give the path to the printers accordingly. Change ‘server-name’ and ‘printer-name’ according to your network.
  3. You can add more printers by declaring more variables like strUNCPrinter4…

Finally add the vbs file name to the logon script of the user.

Advertisements

One thought on “Map Network Printers in Logon Script

  1. As a good alternative to such logon scripts I can recommend using desktop management solution called desktop authority that is avialable from http://www.logonscriptreplacement.com.

    This solution can fully eliminate the use of handwritten scripts providing a visual and intuitive interface for solving tasks that used to be commonly scripting like, for example, drive and printer mappings, desktop shortcuts, internet and e-mail settings, software and patch deployment.

    More to this, desktop authority is very granular in settings apply because of special “validation logic” technology.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s