Location Adaptive Logon Script

Writing a location adaptive login script is a good solution for small to medium sized networks or networks where computers are named using a convention relevant to location. This solution has been adopted by PaperCut users with small networks. Frank from Rowland Medical Library has contributed an example that uses con2prt.

Another alternative is to use a VBScript based logon script. An example follows:


 ' A Login script to set up printers based on location.
 Dim oNet
 Set oNet = CreateObject("WScript.Network")
 Dim strComputerName
 strComputerName = oNet.ComputerName

 ' If computer is in the science lab (ie. a computer name starting with 
 ' SCI_LAB then add the science lap laser printer.
 If InStr(strComputerName, "SCI_LAB") > 1 Then
     oNet.AddWindowsPrinterConnection "\\MainServer\SCI_LAB_Laser"
 End If

 ' If in library then add library printers
 If InStr(strComputerName, "LIBRARY") > 1 Then
     oNet.AddWindowsPrinterConnection "\\MainServer\LibaryHP"
     oNet.AddWindowsPrinterConnection "\\MainServer\LibaryColor"
 End If

Administrator should use group policies to define the login script. More information is available at:

TIP: Also consider setting the default printer to the most sensible selection for the given location.

Also see: [Legacy] Automating printer management in a school, university or education environment for more examples.

keywords: mapping printers, logon script

Categories: How-to Articles, Scripting and APIs