We were running SQL2016 on Windows 2012R2 without issues. We've just had an OS upgrade to Windows 2019 and now we can't run SQLPS.exe or any SQL Agent PowerShell steps. SQLPS.exe returns:
import-module : File E:\Program Files (x86)\Microsoft SQL Server\130\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
At line:1 char:1
+ import-module SQLPS
+ CategoryInfo : SecurityError: (:) [Import-Module], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand
Running "Get-ExecutionPolicy -List" in SQLPS returns:
whereas on our other SQL servers it's:
This appears to be set in the registry at:
on the server that's working, but it's completely missing on the upgraded server that no longer works.
Is there a way to repair SQLPS, if that would help?