Skip to content

Instantly share code, notes, and snippets.

@jimdiroffii
Created September 14, 2020 14:57
Show Gist options
  • Save jimdiroffii/dc9f8d4e7cc34ffaeff49aeddacf82b7 to your computer and use it in GitHub Desktop.
Save jimdiroffii/dc9f8d4e7cc34ffaeff49aeddacf82b7 to your computer and use it in GitHub Desktop.
Map network printers and set default printer in Windows 7
Option Explicit
Dim objNetwork, strLocal
Dim strUNCPrinter1
Dim strUNCPrinter2
Dim strUNCPrinter3
Dim strUNCPrinter4
Dim strUNCPrinter5
Dim strUNCPrinter6
strUNCPrinter1 = "\\<servername>\<printername>"
strUNCPrinter2 = "\\<servername>\<printername>"
strUNCPrinter3 = "\\<servername>\<printername>"
strUNCPrinter4 = "\\<servername>\<printername>"
strUNCPrinter5 = "\\<servername>\<printername>"
strUNCPrinter6 = "\\<servername>\<printername>"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
objNetwork.AddWindowsPrinterConnection strUNCPrinter2
objNetwork.AddWindowsPrinterConnection strUNCPrinter3
objNetwork.AddWindowsPrinterConnection strUNCPrinter4
objNetwork.AddWindowsPrinterConnection strUNCPrinter5
objNetwork.AddWindowsPrinterConnection strUNCPrinter6
objNetwork.SetDefaultPrinter strUNCPrinter1
WScript.Quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment