MS SQL Server 無法執行 PowerShell 指令 | Powershell Error Scripts Is Disabled On This System
![圖片](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMGH6rEK3K-K0fMAGdm8yj-ITiJbIj6Xo9TkQCDLYHpnqaJguuyI6QsuZ1S5C1DaoNCPl4ZFMDND7LfTO2YgueHceWI3cLYMQKlCxVkT4Ci89EDDQg7oWvBkDIu5iHJhw3WtZwMT4atJ3A/s320/1188454-fail-stamp-transparent-fail-stamp-png-522_322.png)
今日檢查 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...