Printer Scripts

Posted on 2007-07-27
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
    LVL 5

    Accepted Solution


    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

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
    Learn about cloud computing and its benefits for small business owners.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now