From past couple of days in one of our SQL servers syspolicy_purge_history jobs fails at third step executing a powershell script to clean Phantom Health records. The job is failing with the error:
Application popup error - SQLPS.exe The application was unable to start correctly (0xc0000142). Click OK to close the application.
Edit: Identified that this happens only when calling this from SQL Agent job. When I manually load SQLPS to powershell and run the script it executes just fine. Also, even a simple Write-Host stmt as well fails to execute with the same message above which seems like a security issue to me. But I changed the job owner from sa to a domain account which have both sa and local admin rights on the box with no luck. Any ideas will be appreciated. Thank you!