MS SQL Server 無法執行 PowerShell 指令 | Powershell Error Scripts Is Disabled On This System
今日檢查 Job 運作的紀錄時,突然看到一個很正常的 Job 出錯了!? syspolicy_purge_history 咦?這不是系統內建的 JOB 嗎?安裝好 SQL Server 後就存在了啊! 怎麼會報錯呢? 查看了一下錯誤內容顯示: Executed as user: NT Service\SQLSERVERAGENT. 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\120\Tools\PowerShell\Modules\SQLPS\Sqlps.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170. File C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\SQLPS\Sqlps.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about...