Presentation is loading. Please wait.

Presentation is loading. Please wait.

07 | Error Handling Jeffrey Snover | Distinguished Engineer & Lead Architect Jason Helmick | Senior Technologist, Concentrated Technology.

Similar presentations


Presentation on theme: "07 | Error Handling Jeffrey Snover | Distinguished Engineer & Lead Architect Jason Helmick | Senior Technologist, Concentrated Technology."— Presentation transcript:

1 07 | Error Handling Jeffrey Snover | Distinguished Engineer & Lead Architect Jason Helmick | Senior Technologist, Concentrated Technology

2 Module Overview Error Actions - $ErrorActionPreference
Setting the action or variable Using Try…Catch…Finally A Better Example Logging your errors

3 $ErrorActionPreference
Whenever a PowerShell command encounters a non- terminating error, it checks a build-in variable $ErrorActionPreference. Continue – This is the default. Displays error and keeps running. SilentlyContinue – Keeps running but does not display the error. Stop – Displays error and stops execution Inquire – Prompts you for the next action Demonstration Examples

4 Setting the action or variable
-ErrorAction, which can be abbreviated as –EA -ErrorVariable, which can be abbreviated as -EV

5 Catching errors with Try…Catch…Finally

6 A better example Many ways to do this, here is one… Demonstration Code

7 Logging your errors Why not use a log file for your errors!
Demonstration Code

8 Questions or comments?

9


Download ppt "07 | Error Handling Jeffrey Snover | Distinguished Engineer & Lead Architect Jason Helmick | Senior Technologist, Concentrated Technology."

Similar presentations


Ads by Google