These page we will see error types, the $error variable, try/catch blocks and error action preferences in powershell
Two Types of errors :
1. Terminating Error
2. Non-Terminating Error
While in Powershell script execution, either type of error occurs during execution from above mentioned types, it is logged to a global variable called $error.
$error is a collection of PowerShell Error Objects.
$error is nothing but arraylist.
you can fire below query to check the type
You can travers to all errors with the most recent error at index 0.
Lets fire any cmdlet which doesn't exits
$error | gm
The Try, Catch, and Finally statements allow us to control script flow when we encounter errors.
The statements behave similar to the statements of the same name found in C#, Java and other languages.
Copy and Try it
TO BE CONTINUED..