Hello,
I'm using powershell to execute some CU, something like this:
Invoke-NAVCodeunit -CodeunitId 7172409 -ServerInstance DynamicsNAV71 -CompanyName $Comp.CompanyName
And the console returns (in red!) something like this:
Invoke-NAVCodeunit : " The vendor XXX is blocked"
I need to handle the posible errors wich the CU returns to send mail reporting, but there is no way to "catch" that exception as an error.
Any idea??
Thank you very much!!
0
Comments
$Error.Clear()
Invoke-NAVCodeunit.... # you're NAV process
if ($Error.Exception.message -notlike "")
{
SendNavMail $MyInvocation.MyCommand.Name $Comp.CompanyName $Error.Exception.message
}
I crated the function SendnavMail in a new module. Its important to clear de error variable because its acumulative.