K2000 continue on error for individual packages on Scripted Install
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.
3 Comments
[ + ] Show comments
-
Do you want to ignore all errors or just some? - LBarclay 10 years ago
-
Errors on just that post install action. I have other actions like installing Office, Acrobat, AV, etc where I do want it to stop. - JordanNolan 10 years ago
-
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? - horstj 9 years ago
Answers (1)
Answer Summary:
Please log in to answer
Posted by:
rileyz
10 years ago
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.
Comments:
-
I do not want to disable the error on the script because it is used in the logs for the script. - JordanNolan 10 years ago
-
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. - rileyz 10 years ago