[Last Call] Learn how to a build a cloud-first strategyRegister Now


Printer Scripts

Posted on 2007-07-27
Medium Priority
Last Modified: 2010-04-12
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?

Question by:ictman

Accepted Solution

ardrac earned 1000 total points
ID: 19581852

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.

LVL 14

Assisted Solution

canali earned 1000 total points
ID: 19583177
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

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you considered what group policies are backwards and forwards compatible? Windows Active Directory servers and clients use group policy templates to deploy sets of policies within your domain. But, there is a catch to deploying policies. The…
Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question