Catch-Error.ps1
#Requires -Version 2 # Show-TryCatchFinally.ps1 # Demonstrates try/catch/finally in V2 # First, try something that will work Try { $I=1 } Catch {"Caught a problem in try 1" } Finally { "All done with 1st try" } # Now try something that fails $one=1 #$zero=0 Try { $one/$zero} Catch {"Caught a problem in try 2"}
Default Error Handling
Error handling in PowerShell scripts
Lunch Lesson: Error Handling in PowerShell
Methods for handling errors in PowerShell can range from simple to complex
No comments:
Post a Comment