Summary: Here is the answer to the fourth question in Mini-Scripting Games 2014.
You are attempting to use Try/Catch/Finally in your script. No matter what you try,
the script never seems to catch it. What is the most likely cause of the problem?
The most likely cause of the problem is that your Try statement does not generate a terminating error,
and therefore, there is nothing for Catch to catch.
One easy way to fix this is to change your $ErrorActionPreference variable from Continue to Stop.
This will cause your non-terminating errors to actually terminate and send the control to the
Catch portion of your script.
0 comments