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.


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:


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


Return to the VBScript to Windows PowerShell home page