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


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 = "\\YourServer\YourPrinterShare"
PrinterDriver = "YourPrinterDriver"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
WshNetwork.SetDefaultPrinter "\\YourServer\YourPrinterShare"

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 = "\\YourServer\YourPrinterShare1"
        PrinterDriver = "YourPrinterDriver1"
        WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
        WshNetwork.SetDefaultPrinter "\\YourServer\YourPrinterShare1"
    
    Case "Username2"

        PrinterPath = "\\YourServer\YourPrinterShare2"
        PrinterDriver = "YourPrinterDriver2"
        WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
        WshNetwork.SetDefaultPrinter "\\YourServer\YourPrinterShare2"
    
End Select
Using a logon script or Group Policy, run the script each time a user logs on to Terminal Services.


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish