Catch block does not work correctly for exceptions from get-spweb and get-spsite without the -ErrorAction Stop parameter. This code will not print "in catch block" try{Get-SPWeb 'wrong url'} catch { Write-Host "in catch block" } correct usage : try{Get-SPWeb 'wrong url' -ErrorAction Stop } catch { Write-Host "in catch block" }
My place to share my thoughts on Technology, Leadership, Movies, Books, Philosophy and anything that gets me thinking.