When an error occurs in a script I have been attempting to capture the error message from the Error object:
# this doesn't seem to work $msg = $Error.Message
My understanding is the $Error is a collection of exceptions. I have tried various ways to access the object and also looked at the Format-List * output.
Can anyone suggest the best way to capture the error message from a Error[n] object?
Business Case: clear, concise error logging; do not desire the whole exception object.