$_will contain the last error that occurred, as will
$Error. Use either - but immediately copy them into your own variable, as executing additional commands can cause
$_to get "hijacked" or
$Errorto contain a different error.
$Errorin most cases.
$Errorwill be the last error, and PowerShell will maintain the rest of the