Hands up, fair cop. In a recent blog post on scripting Internet Explorer Favorites I forgot to mention using script exit codes when I dealt with the custom actions. Any custom script you include in your configuration is always interpreted as completing successfully by the agent on exit unless you specify otherwise in your code. As we were just firing off some pretty basic scripting and not needing to know the return code of the script to leverage another trigger I didn’t use it. I guess the more stricter of coder would always include error control so I bow submissively to anyone who suggests I should have used it too.
In the blog post “scripting Internet Explorer Favorites” we used some vbscript. The correct success/fail exit code to use in this example would be:-
1 |
WScript.Quit [value] |
Other scripting languages would be:-
JScript:-
1 |
WScript.Quit([value]) |
PowerShell:-
1 |
exit ([value]) |
[value] should be replaced with the exit code appropriate for the scripting language used. 0 is used for success and 1 is used for failure.
For example:
1 |
WScript.Quit 1 |
1 |
WScript.Quit(1) |
1 |
exit (1) |