PowerShell - Error Handling
This script is meant to handle errors but the catch block doesn't run. What is the problem?
try {
Get-Item 'C:\nonexistentfile.txt' -ErrorAction SilentlyContinue
} catch {
Write-Output 'Error caught.'
}
Write-Output 'Done.'