Sqlps utility fails to run when the "Turn on Script Execution" policy is set to "Allow all scripts" in SQL Server

If you set the Turn on Script Execution Group Policy setting to Allow all Scripts, the sqlps utility fails to run, and you receive the following error message:
Microsoft (R) SQL Server (R) PowerShell
Version 11.0.5058.0
Copyright (c) 2012 Microsoft. All rights reserved.

set-executionpolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will retain its current effective execution policy of "Unrestricted". Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information, please see "Get-Help Set-ExecutionPolicy."

At line:1 char:20
+ set-executionpolicy <<<< RemoteSigned -scope process -Force
+ CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
+ FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand

Additionally, the syspolicy_purge_history job fails.

Note The Turn on Script Execution Group Policy setting can be configured in the following location in the Group Policy Management Console:
Administrative Templates\Classic Administrative Templates\Windows Components\Windows PowerShell


Update information

This issue is fixed in the following cumulative updates of SQL Server:

Cumulative Update 4 for SQL Server 2012 Service Pack 3

Cumulative update 9 for SQL Server 2014 SP1

Cumulative update 3 for SQL Server 2014 SP2

Recommendation: Install the latest cumulative update for SQL Server

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Learn about the terminology that Microsoft uses to describe software updates.

Article ID: 3122088 - Last Review: 12/28/2016 18:09:00 - Revision: 7.0

Microsoft SQL Server 2012 Enterprise, Microsoft SQL Server 2014 Service Pack 1, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise Core

  • kbqfe kbfix kbexpertiseinter kbsurveynew KB3122088