December 2015
Intermediate to advanced
760 pages
14h 31m
English
In this recipe, we will learn how to display additional error messages.
Let's take a look at how to display additional error messages:
Clear-Host $error[0] | Format-List -Force
PowerShell supports some variables called automatic variables that store the state information or environment information, such as arguments, events, user directories, profile information, or error codes. The $error is an automatic array variable that holds all the error objects that are encountered in your PowerShell session. To display the last error message, you can use the following code:
$error[0] | Format-List -Force
This method is particularly ...
Read now
Unlock full access