SQL Powershell (SQL Server 2014) does not start because of insufficient execution policy "Restricted" on "Process" scope

After migration to Windows 10 and PS 4.0 SQL PowerShell cannot be launched by SQL Server. SQL PS tries to load module SQLPS but the execution policy is set to "Restricted" at process level. Because manual setting of execution policy on this level is not made persistent there seems I don't see an workaround.

I tried to set variable PSExecutionPolicyPreference = RemoteSigned in the system environment. Standalone PowerShell friendly reflects that in its reports as a setting for "Process" scope. But in SQL PowerShell this is not used to override the "Restricted" value.

Any idea how to fix

August 30th, 2015 10:30pm

Hi VIMD,

I posted a specific question related to starting of Powershell from SQL Server Management Studio. My problem is, that that there is wrapper named SQLPS.EXE that calls PowerShell with ExecutionPolicy set to "Restricted" on the Process level.

All things you posted are well known here and it is preliminary knowledge to Execute SET-ExecutionPoliy to RemoteSigned  when beginning loading modules and executing PS1-scripts. BTW ExecutionPolicy does not reflect the trustworthiness of Powershell. It addresses the scripts from other people. It's like macros in Office well done to protect from virus in these external components.

So any idea from where SQLPS.EXE gets the setting for this ExecutionPolicy setting and uses it so badly, that the SQL Modules do not load? I have set the defaults properly using environment variable "PSExecutionPolicyPreference = RemoteSigned".  

Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 5:44pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics