VB Script Adding Network Printers
Posted on 2006-04-14
I have a VBS script that I've written that almost does what I want it to. See Below. Here's my problem. If the user doesn't have one of the specified printers mapped, the script errors out and doesn't finish. Is there another IF statement or else statement I can add that will check to see if the user has the printer mapped and if not continue with the script removing the printers they do have.
This is what I have:
Set WshNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("Wscript.Shell")
strCommand = "%comspec% /c P:\IfMember.exe Sales"
intReturn = objShell.Run(strCommand, 2, True)
If intReturn = 1 Then
Depending on the line the script stops on this is a typcial error.
error: This network connection does not exist