Err Object Description Property


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

  

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.