Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer Log In Script

Status
Not open for further replies.

deklin

IS-IT--Management
Nov 6, 2002
157
US
Hello,

Is there anyway to associate printers in a login script?

Thanks a lot,
D

Deklin [yinyang]

"What goes up must come down. Ask any system administrator."
 
Piece of cake, but only in a login script, not a startup script. In other words it's easy to do on a user basis, but not on a copmputer basis. If you want some sample code snippets let me know and I can forward you some examples based on what we use at my college to assign printers and default printers to computer labs.

JP
 
Actually i am looking to associate specific printers to specific users when they log into windows 2k/xp machines on a windows 2k server. I have a few people who jump around from desk to desk and i am just looking for a way to have their printers follow them...just like mapped drives. Any examples you can provide will be greatly appreciated

Thanks a lot

d

Deklin [yinyang]

"What goes up must come down. Ask any system administrator."
 
That's a piece of cake using vbscript and a login script. Here's one example:

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddwindowsPrinterConnection "\\adps\BEC152 Laser"
WshNetwork.SetDefaultPrinter "\\adps\BEC152 Laser"

adps is the print server name, BEC152 Laser is the queue name on the print server. Just push this sort of thing out through group policy / login scripts under the user node and you should be good to go.

JP
 
This script will map printers based on the first 3 characters of the station name so if they have location specific names then the user will get the printer for that location. You could also specify the full station name if your station names are not organised by location.

Code:
Set Network = CreateObject("Wscript.Network") 
compname = network.computername
room = left(compname,3)
   
Select Case room
          Case "DP1"
        Network.AddWindowsPrinterConnection "\\server1\DP1Laser" 
        Network.SetDefaultPrinter "\\server1\DP1Laser" 

          Case "DP2"
        Network.AddWindowsPrinterConnection "\\server1\DP2Laser" 
        Network.SetDefaultPrinter "\\server1\DP2Laser" 


case else
 
End Select

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top