Discussion Locked

Nework Printing

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
What is a logon scrip and how should i implement a logon script on all computers on the network to automatically add a default printer on all the computer for all the users?

7 replies

by justanadmin

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 foreach 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

by ksandy

Thew answer still refers to the username and not the computer name. I will like to add the printer to the default user or computer profile so that anyone can go and use the computers and still print without having to add the printer, the printer must be automatically added anyones profile when they log on to any computers in the lab.

by ksandy

Thew answer still refers to the username and not the computer name. I will like to add the printer to the default user or computer profile so that anyone can go and use the computers and still print without having to add the printer, the printer must be automatically added anyones profile when they log on to any computers in the lab.

by georgevlob

The above should work, but if you want a one-liner, enter the following:

rundll32 printui.dll,PrintUIEntry /in /n \\Server\PrinterName

This discussion is closed to new replies.