JSI Tip 2708. How do I map a network printer on Terminal Service?

Jerold Schulman

August 13, 2000

1 Min Read
ITPro Today logo in a gray background | ITPro Today


Terminal Services on Windows 2000 and Windows NT 4.0 can NOT automatically map a network printer. A Printer that is locally attached to a LPT, COM, or USB port can be automatically mapped.

You can map a network printer by using the Windows Scripting Host (WSH) to run a Visual Basic script:

Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\YourServerYourPrinterShare"
PrinterDriver = "YourPrinterDriver"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
WshNetwork.SetDefaultPrinter "\YourServerYourPrinterShare"

NOTE: YourPrinterDriver must exactly match the driver name in the Ntprint.inf file.

If you wish to add a different printer for each user who logs on to Terminal Services:

Set WshNetwork = CreateObject("WScript.Network")Select Case WshNetWork.UserName    Case "Username1"        PrinterPath = "\YourServerYourPrinterShare1"        PrinterDriver = "YourPrinterDriver1"        WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver        WshNetwork.SetDefaultPrinter "\YourServerYourPrinterShare1"        Case "Username2"        PrinterPath = "\YourServerYourPrinterShare2"        PrinterDriver = "YourPrinterDriver2"        WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver        WshNetwork.SetDefaultPrinter "\YourServerYourPrinterShare2"    End Select

Using a logon script or Group Policy, run the script each time a user logs on to Terminal Services.


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like