Dhattks
asked on
VB script to continue despite error
I have a B.B. Script where it calls for 10 .msu file (windows updates) It works fine on workstations where i have Internet Explorer 8 and none of these updates installed.
So the script runs fine and move to next task of installing IE11 But on the workstations that have IE 9 or10 installed, the script fails and stops without proceeding When run manually on the workstations I get message "this update not applicable to workstation" or "already installed" and windows log throws the error not failed script.
I tried putting a line "On Error Resume Next" but seems like does kid work.
I want the script to run and ignore these messages and move to next and hence complete and move to install task for IE.
Original script is:
Dim objfso, objShell
Dim folder, files, sFolder, folderidx, Iretval, return
Set objfso = CreateObject("Scripting.Fi leSystemOb ject")
Set objShell = CreateObject("Wscript.Shel l")
sFolder = left(WScript.ScriptFullNam e,(Len(WSc ript.Scrip tFullName) )-(len(WSc ript.Scrip tName)))
Set folder = objfso.GetFolder(sFolder)
Set files = folder.Files
For each folderIdx In files
If Ucase(Right(folderIdx.name ,3)) = "MSU" then
wscript.echo "wusa.exe " & sfolder & folderidx.name & " /quiet /norestart"
iretval=objShell.Run ("wusa.exe " & sfolder & folderidx.name & " /quiet /norestart", 1, True)
If (iRetVal = 0) or (iRetVal = 3010) then
wscript.echo folderidx.name & " Success"
Else
wscript.echo folderidx.name & " Failed"
wscript.quit(1)
End If
End If
Next
So the script runs fine and move to next task of installing IE11 But on the workstations that have IE 9 or10 installed, the script fails and stops without proceeding When run manually on the workstations I get message "this update not applicable to workstation" or "already installed" and windows log throws the error not failed script.
I tried putting a line "On Error Resume Next" but seems like does kid work.
I want the script to run and ignore these messages and move to next and hence complete and move to install task for IE.
Original script is:
Dim objfso, objShell
Dim folder, files, sFolder, folderidx, Iretval, return
Set objfso = CreateObject("Scripting.Fi
Set objShell = CreateObject("Wscript.Shel
sFolder = left(WScript.ScriptFullNam
Set folder = objfso.GetFolder(sFolder)
Set files = folder.Files
For each folderIdx In files
If Ucase(Right(folderIdx.name
wscript.echo "wusa.exe " & sfolder & folderidx.name & " /quiet /norestart"
iretval=objShell.Run ("wusa.exe " & sfolder & folderidx.name & " /quiet /norestart", 1, True)
If (iRetVal = 0) or (iRetVal = 3010) then
wscript.echo folderidx.name & " Success"
Else
wscript.echo folderidx.name & " Failed"
wscript.quit(1)
End If
End If
Next
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.