Converting VBScript's Err Object Number Property

Definition: Returns or sets a numeric value specifying an error. Number is the Err object's default property.

Number

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, ErrorRecord usually returns a string value such as this:

ScriptHalted

Still, you can always give this command a try and see what happens:

$error[0].errorrecord

Return to the VBScript to Windows PowerShell home page