Printer Scripts

Can anyone help me please i have about 7 networked [printers. I want to create a vbs file to connect a printer to a workstation by the computername.

e.g if conm[puter name is 123 it connects to printer 123.

I have seen loads of scripts select case and the rest..............

But i can not get any to work.

Is there a simple script i could use?

Who is Participating?
ardracConnect With a Mentor Commented:

Have a read of;

Im not quite sure what you are trying to acheive, is it a login script, desktop icon etc. but the above should help.

canaliConnect With a Mentor Commented:
I hope the script is what you want
Bye Gastone Canali
' mapPrn.vbs
Sub MapPrinter(sUNC)
dim oNet
 Set oNet = WScript.CreateObject("WScript.Network")
 oNet.AddWindowsPrinterConnection sUNC
 oNet.SetDefaultPrinter sUNC
End Sub

Set WshNetwork=WScript.CreateObject("WScript.Network")

'*** if pcName=printerName
'mapprinter "\\" & ComputerName & "\" & ConputerName
' *** You don't need the select case block
' *** decomment mapprinter line and your scrip end here

Select Case sComputerName
 Case "PC11"
   MapPrinter "\\pc1\laser"
 Case "PC2", "PC-CLIENT1"
  MapPrinter "\\print-svr01\HPcolor"
 Case "COMPUTER100"
  MapPrinter "\\marketingsvr\LaserColor"
  case else
 wscript.echo "Pc not found"
End Select
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.