I upgraded a Windows Server 2012 to 2019, but kept the SQL Server (110)
My sql agent jobs stopped working, the ones using PowerShell commands.
I get the error message
A job step received an error at line 1 in a PowerShell script.
The corresponding line is 'import-module SQLPS -DisableNameChecking'.
Correct the script and reschedule the job.
The error information returned by PowerShell is:
'File C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\SQLPS\Sqlps.ps1
cannot be loaded because the execution of scripts is disabled on this system.
Please see "get-help about_signing" for more details.
The Sqlps.ps1 IS signed with a valid signature, and I even temporarily tried to Set-ExecutionPolicy Unrestricted
, but that didn't help either. (All suggested by chatgpt ;-) )
My script should download a file from an url and place it in c:\tmp
EDIT: Solved, I set the script execution policy to "Allow local scripts and remote signed scripts" in group policy for computer; it was pereviously "Not Configured"