0

While trying to run Get-BpaModel I'm running into:

Get-BpaModel : There has been an error while trying to set the process wide execution policy. (Inner Exception:
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:1
+ Get-BpaModel
+ ~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-BpaModel], CommandLetException
    + FullyQualifiedErrorId : SetExecutionPolicyError,Microsoft.BestPractices.Cmdlets.GetModelCommand

The result of get-executionpolicy:

PS C:\Windows\system32> Get-ExecutionPolicy
Unrestricted
PS C:\Windows\system32> Get-ExecutionPolicy -list

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy    Unrestricted
   UserPolicy    Unrestricted
      Process    RemoteSigned
  CurrentUser          Bypass
 LocalMachine    Unrestricted

Running the same command with set-execution policy set:

PS C:\Windows\system32> Set-ExecutionPolicy Unrestricted | Get-BpaModel


Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
http://go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
Get-BpaModel : There has been an error while trying to set the process wide execution policy. (Inner Exception:
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:36
+ Set-ExecutionPolicy Unrestricted | Get-BpaModel
+                                    ~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-BpaModel], CommandLetException
    + FullyQualifiedErrorId : SetExecutionPolicyError,Microsoft.BestPractices.Cmdlets.GetModelCommand

From the GPO:
Policy
Setting
Winning GPO
Turn on Script Execution
Enabled
Default Domain Policy
Execution Policy Allow all scripts

Any ideas how to solve this?

The expected result is for the model to work. See above for all troubleshooting steps

2
  • Does it work if you launch powershell with powershell.exe -ExecutionPolicy Bypass? Commented Aug 22, 2024 at 10:19
  • Nope. Same issue Commented Aug 22, 2024 at 11:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.