简体   繁体   English

Intellij没有为Powershell选择正确的执行策略

[英]Intellij not picking up correct execution policy for powershell

Ive changed my Powershell execution policy from Restricted to RemoteSigned . Ive将我的Powershell执行策略从Restricted更改为RemoteSigned If I open up a new Powershell terminal and run Get-ExecutionPolicy I get back RemoteSigned . 如果打开新的Powershell终端并运行Get-ExecutionPolicy RemoteSigned返回RemoteSigned

I've also setup Powershell to run in Intellij instead of the default command prompt. 我还将Powershell设置为在Intellij中运行,而不是在默认命令提示符下运行。 However when I run Get-ExecutionPolicy in Intellij's terminals (note: I have restarted Intellij after changing the policy) I still get back Restricted . 但是,当我在Intellij的终端中运行Get-ExecutionPolicy时(注意:更改策略后,我已重新启动Intellij),我仍然会返回Restricted

Why is that and how do I get Intellij to pick up my actual execution policy? 为什么会这样,我如何让Intellij选择我的实际执行策略?

There are multiple scopes of PowerShell execution policy ( MachinePolicy , UserPolicy , Process , CurrentUser , LocalMachine ). PowerShell执行策略有多个范围( MachinePolicyUserPolicyProcessCurrentUserLocalMachine )。 You can read about them in build-in PowerShell help: Get-Help about_Execution_Policies . 您可以在内置的PowerShell帮助中了解它们: Get-Help about_Execution_Policies But what is not mentioned in that help is, that LocalMachine scope is separate for x86 and x64. 但是该帮助中未提及的是, LocalMachine范围对于x86和x64是分开的。 So, if you changing execution policy in LocalMachine scope, which used by default if you does not specify -Scope parameter for Set-ExecutionPolicy cmdlet, than you have to do it twice: once for x86 and once for x64. 因此,如果您在LocalMachine范围中更改执行策略(如果未为Set-ExecutionPolicy cmdlet指定-Scope参数,则默认使用该策略),则必须执行两次:一次用于x86,一次用于x64。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM