I am assembling a scripted install and I have a package (vbscript) that generate an error code for a lot off issues.  Most of the time it is fine and when it is not I really don't want it to hold up the rest of the install.  Is there a way I can ignore the errors for this particular item.

Answer Summary:
Cancel
3 Comments   [ + ] Show Comments

Comments

  • Do you want to ignore all errors or just some?
  • Errors on just that post install action. I have other actions like installing Office, Acrobat, AV, etc where I do want it to stop.
  • I am running into this same problem. Up until the most recent update, when there was an error on a particular task, the SI install kept running and then I just made sure everything looked good when it finished. Now, when a task such as Office install fails, the whole SI hangs and then when I come back I have to answer the prompt on what to do and then wait for the rest of the script to run. Is there no way to tell the K2000 or SI to continue on error?
Please log in to comment

Answers

1

My scripting foo isnt the best, but you could do this. 

 

 

Put this line before the error you are trying to ignore

 on error resume next 'Disable error handling.

 

Then put this line in after to enable error capturing again

 on error goto 0 'Enable error handling.

 

 

 

 

Example:
I used this to check that WMI is ok. 

Set objWMIService = GetObject("winmgmts:\\" & strComputer &"\root\cimv2")
on error resume next 'Disable error handling.
If Err.Number <> 0 Then
    objLogFile.Write "Uh oh! There was a error connecting to WMI." & vbcrlf 'writing to log
	objLogFile.Write "Ending logging at " & Now & vbcrlf & vbcrlf & vbcrlf 'writing to log
	'WScript.Echo err.number
	Wscript.Quit
	
End If
on error goto 0 'Enable error handling.

 

Answered 03/24/2014 by: rileyz
Red Belt

  • I do not want to disable the error on the script because it is used in the logs for the script.
    • I think this is correct.

      The above wont stop the error from happening, it will just allow the scripting host to allow carry on processing, so the error dialog wont prompt - hope you get what I mean.

      So it will run, disable error prompting.
      opps there was a error but not prompting.
      your code to write to the logs or what ever
      enable logging again.

      See my example i just added.
Please log in to comment
Answer this question or Comment on this question for clarity