At last week’s UK PowerShell User Group meeting, Jeremy gave a talk on Error handling. It got me thinking about the whole business of errors and error handling in PowerShell. One of the great differences between casual and production scripts is the need...
< # .SYNOPSIS Shows Try/Catch/Finally using Powershell .DESCRIPTION This is an MSDN Sample, re-written in PowerShell .NOTES File Name : get-trycatchfinally.ps1 Author ...
# 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 ...