Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Help with If Or statement in wscript

$
0
0

Hello,

I'm very new to scripting and i've put a script together for desktop techs to set a global printer to a computer.  The script will pop up a box and they put the printer name in and then it runs the rundll32 printui.dll PrintUIEntry command and then stops and restarts the print spooler.  The problem i'm running into is we have 2 different printer servers that are printers reside on.  The printer server names are "vps01" and "vps02"  Instead of having 2 different scripts for each print server i'd like to put in a If Or statement in my script that would run the command line for either print server.  Here is the code i have, let me know what you think.  Any help is much appreciated!

Dim objNet, strPrinter

Set objNet = CreateObject("Wscript.Network")

strPrinter = InputBox("Please enter the name of the Printer you'd like to add", "Add Printer", "eg. printer name")

Set objShell = CreateObject("WScript.Shell")

If strCommand = "cmd /c rundll32 printui.dll,PrintUIEntry /ga /n\\vps01\" & strPrinter Or strCommand = "cmd /c rundll32 printui.dll,PrintUIEntry /ga /n\\vps02\" & strPrinter Then

objShell.Run strCommand, 1, True

End If

I didn't add the 2nd half of the script which is to reset the spooler.  Let me know if needed




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>