The job syspolicy_purge_history fails at the 3rd step. The error that I get is the following one:

Executed as user: UserABC. A job step received an error at line 1 in a PowerShell script. The corresponding line is 'set-executionpolicy RemoteSigned -scope process -Force'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Security error. '. Process Exit Code -1. The step failed.

Was wondering if you guys have faced this before and how to go about fixing this.


1 Answer 1


Thanks to the comment of @Tony Hinkle. I was able to resolve the issue based on the comment at the bottom of this thread.

SQL Server 2012 syspolicy_purge_history fails step 3 "Erase Phantom System Health Records."

Under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps130 I changed the key ExecutionPolicy value to Unrestricted.

I did not make any changes to keys under HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqltoolsps130.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.