I\'m having an issue with PowerShell where it will not catch an exception even when the exception is explicitly mentioned in the catch command.
In this case, I\'m tr
When you set ErrorAction to Stop, non-terminating errors are wrapped and thrown as type System.Management.Automation.ActionPreferenceStopException, this is the type you want to catch.
try
{
Get-Process -Id 123123 -ErrorAction Stop
}
catch [System.Management.Automation.ActionPreferenceStopException]
{
... do something ...
}