Converting VBScript's Err Object Source Property

Windows PowerShell

Definition: Returns or sets the name of the object or application that originally generated the error.

Err Object Source Property

To determine which object or component was responsible for an error you can check the value of the Source property. This command assigns the Source property for the most recent error in the error collection to the variable $a:

$a = $error[0].source

When you run this command and then echo back the value of $a you should back something similar to the following:


Return to the VBScript to Windows PowerShell home page