Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting VBScript's Err Object Description Property

Windows PowerShell

Definition: Returns or sets a descriptive string associated with an error.

Err Object Description Property

So what was the last error that occurred? If you need to know that, just get the value of error number 0 and then call the ToString() method. The following command retrieves information from the most recent error and uses the ToString() method to assign the value to the variable $a:

$a = $error[0].ToString()

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

The term 'error[0]' is not recognized as a Cmdlet, function, operable program, or script file. Verify the term and try again.

Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft