Windows Server升级后SQL Server Agent的PowerShell作业无法执行如何解决?
问题
将Windows Server 2012升级至2019后保留了SQL Server 110版本,原本正常运行的SQL Server Agent PowerShell作业停止工作,报错信息如下:
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.
已知Sqlps.ps1带有有效签名,且已尝试执行Set-ExecutionPolicy Unrestricted,但问题仍未解决。该作业脚本的功能是从指定URL下载文件并保存至c:\tmp目录。
解决方法
通过修改计算机组策略中的脚本执行策略,将其设置为「允许本地脚本和远程签名脚本」(此前为「未配置」),问题已解决。
内容的提问来源于stack exchange,提问作者Leif Neland
相关产品推荐
相关产品推荐

