Changing default printer script

Home Forums Scripting General Scripting Changing default printer script

Viewing 1 post (of 1 total)
  • Author
  • Avatar


    I’m looking for a script that changes the default to another printer if the
    local printer is not installed on the local PC.

    At the moment i have this:

    Option Explicit

    Dim objNetwork

    Set objNetwork = CreateObject(“WScript.Network”)

    Dim WshShell: Set WshShell = CreateObject(“Wscript.Shell”)

    Dim strLocal1, strLocal2, strUNCPrinter1, strUNCPrinter2, strLocal
    strUNCPrinter1 = “\print-serverHP Universal Printer for accounts”
    strUNCPrinter2 = “\print-serverRicoh Aficio 1224C PCL 5c”
    strLocal1 = “\print-serverHPDesignJet”
    strLocal2 = “\print-serverDYMO”
    strLocal = “Accounts Printer”

    objNetwork.AddWindowsPrinterConnection strUNCPrinter1
    objNetwork.AddWindowsPrinterConnection strUNCPrinter2
    objNetwork.AddWindowsPrinterConnection strLocal1
    objNetwork.AddWindowsPrinterConnection strLocal2

    objNetwork.SetDefaultPrinter strLocal


    strLocal is the locally installed printer but if it doesn’t exist i want the
    default printer to be strUNCPrinter2.

    Please help, many thanks

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.