Number
Definition: Returns or sets a numeric value specifying an
error.
Numberis the
Errobject's default property.
We’re just guessing here, but we assume that the ErrorRecord property is designed to return the error number. However, we’ve never actually encountered a numbered error in Windows PowerShell; in our experience, ErrorRecordusually returns a string value such as this:
ScriptHalted
Still, you can always give this command a try and see what happens:
$
error[0].
errorrecord