Powershell 将执行策略设置回限制?

问题描述 投票:0回答:2

我安装了个人版chocolaty,所以从

AllSigned
添加了执行策略到
Restricted
,我想再次回到
Restricted
。但是chocolaty install命令将其设置为
Bypass
并且它在
Set-ExecutionPolicy
命令上得到了PermissionDenied。

    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 Bypass. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more
information please see "Get-Help Set-ExecutionPolicy".
At line:1 char:1
+ Set-ExecutionPolicy Restricted
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
    + FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand

如何设置回受限,是否需要设置回受限或其他?

powershell chocolatey
2个回答
1
投票

试试这个:

PS C:\> Set-ExecutionPolicy Restricted -Scope Process -Force

0
投票

PS C:\> Set-ExecutionPolicy Restricted -Scope Process -Force

© www.soinside.com 2019 - 2024. All rights reserved.