GET-IT: TEAMS DAY | 1-Day Free Virtual Conference all about Teams. Here on Petri.com - 8/12/20 GET-IT: TEAMS DAY - 8/12/20

VBS network printers and if statement

Home Forums Scripting Windows Script Host VBS network printers and if statement

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    shades
    Member
    #159020

    Hi Everyone,

    I need some help please with the following script. I’m trying to map shared printers (this is working) but make certain printers default for certain users.

    My script:

    On Error Resume Next

    Set WshNetwork = CreateObject(“WScript.Network”)

    WshNetwork.AddWindowsPrinterConnection “\serverHPLaserJet”

    WshNetwork.SetDefaultPrinter “\serverHPLaserJet”

    WshNetwork.AddWindowsPrinterConnection “\server2Samsung”

    WshNetwork.AddWindowsPrinterConnection “\serverCanon”

    WshNetwork.AddWindowsPrinterConnection “\serverBrother”

    if [“%USERNAME%” = “accountant”]
    then
    WshNetwork.AddWindowsPrinterConnection “\server3HP LaserJet 1100 (MS)”
    wshNetwork.SetDefaultPrinter “\server3HP LaserJet 1100 (MS)”
    else
    end if

    wscript.quit

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.