try catch not working

I wrote a custom powershell script and have it run in a workflow.

I'm having an issue with the try catch statement. If I remove try catch and just run the command inside the try method, the workflow executes fine. However, when a try catch is added, the commands inside the try method do not execute. Anyone have an answer to this issue?

try {
    Send-MailMessage -From $From `
        -Subject $Subject `
        -To $To `
        -BodyAsHtml $Body `
        -SmtpServer $Smtp `
        -Attachments $Report `
        -ErrorAction Stop
    }
catch {}

Parents Reply Children
No Data