Using CmdletInvocationException to preserve ErrorRecord