问题标签 [executionpolicy]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
powershell - 关闭窗口后,ExecutionPolicy 重置回未定义
我正在尝试解决一个问题,即我无法从右键菜单运行本地 .ps1 脚本,而每次重新启动后都会出现执行策略更改警告。
重现步骤:
打开提升的 Powershell 并运行:
运行ExecutionPolicy -List
然后返回:
但是在关闭并重新打开 Powershell 窗口并ExecutionPolicy -List
再次运行时,只有LocalMachine
设置保持不变:
为什么其他的不粘?我已经运行DISM restorehealth
并且 sfc /scannow
没有收到任何错误。
powershell - Set-ExecutionPolicy RemoteSigned 禁用自动完成功能
使用 Windows PowerShell 默认颜色设置,错误文本是不可读的。
所以我在 $profile 位置创建了一个配置文件,并将 executionPolicy 设置为 RemoteSigned。
但是,这样做会禁用 PowerShell 的默认功能,例如自动完成等。
我还尝试将 executionPolicy 设置为不受限制。同样的问题。
当我使用 Get-ExecutionPolicy -List 检查时,所有的默认策略都是未定义的
powershell - Powershell 脚本在文件资源管理器的控制台窗口中报告执行策略错误
我的脚本在 ISE 中运行良好,但在 PowerShell 控制台窗口中却没有。
我试图用任何替换"
('
以防万一这是编码错误,但我不确定)。
编辑:脚本在复制并粘贴到控制台时有效,但在使用控制台打开时无效。
这是脚本ZAOCC.ps1:
这是错误消息:
powershell - PowerShell.exe -ExecutionPolicy 绕过 - 脚本中的标头
我正在尝试轻松ByPass
PowerShells ExecutionPolicy
。我意识到一个简单的解决方法是创建runme.ps1
andscript.ps1
并且runme.ps1
我可以调用. 有没有办法把它放在脚本的“标题”中,让它在ing时调用自己?Bypass
ExecutionPolicy
script.ps1
Bypass
ExecutionPolicy
运行me.ps1:
脚本.ps1:
我目前正在研究某种“标志”或“tmpfile”逻辑并让脚本自行调用,但我想知道是否有一种已知/更好的方式,甚至可能的方式让它成为我所有脚本中的标题因此最终用户可以在没有提示的情况下“运行 w/powershell”。
欢迎补充详细说明的答案ExecutionPolicy
,但让我们专注于这个问题。
讨论ExecutionPolicy
应该集中在“Security Stack Exchange”上,相关帖子链接在这里:
https://blog.netspi.com/15-ways-to-bypass-the-powershell-execution-policy/:
但是,重要的是要了解该设置从来都不是安全控制。相反,它旨在防止管理员在脚下开枪。
visual-studio-code - ExecutionPolicy 未定义 - Python 和 Visual Studio 代码
在此处输入图像描述我正在使用 Visual Studio Code 学习 Python。我收到 ExecutionPolicy 愤怒的红色文本。我以管理员身份打开了 Windows Powershell。键入代码:“Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted”。对于 MachinePolicy 和 UserPolicy,我仍然有未定义的 ExecutionPolicy。所以我尝试了“Set-ExecutionPolicy -Scope MachinePolicy -ExecutionPolicy Unrestricted”……但效果并不好,哈哈。我会很感激指导。
'''(基础)PS C:\Windows\system32> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
执行策略更改 执行策略有助于保护您免受您不信任的脚本的影响。更改执行策略可能会使您面临 https://go.microsoft.com/fwlink/?LinkID=135170 上的 about_Execution_Policies 帮助主题中描述的安全风险。是否要更改执行策略?[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help(默认为“N”):Set-ExecutionPolicy:Windows PowerShell 成功更新了您的执行策略,但是该设置被在更具体范围内定义的策略覆盖。由于覆盖,您的 shell 将保留其当前有效的绕过执行策略。键入“Get-ExecutionPolicy -List”以查看您的执行策略设置。有关详细信息,请参阅“Get-Help Set-ExecutionPolicy”。在行:1 字符:1
- Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
(base) PS C:\Windows\system32> protractor conf.js protractor : 术语“protractor”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确并重试。在行:1 字符:1
- 量角器 conf.js
(基础)PS C:\Windows\system32> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy UnrestrictedSet-ExecutionPolicy -Scope MachinePolicy -ExecutionPolicy Unrestricted Set-ExecutionPolicy:无法绑定参数“ExecutionPolicy”。无法将值“UnrestrictedSet-ExecutionPolicy”转换为类型“Microsoft.PowerShell.ExecutionPolicy”。错误:“无法将标识符名称 UnrestrictedSet-ExecutionPolicy 与有效的枚举器名称匹配。指定以下枚举器名称之一,然后重试:Unrestricted、RemoteSigned、AllSigned、Restricted、Default、Bypass、Undefined”在 line:1 char:57
- ... CurrentUser -ExecutionPolicy UnrestrictedSet-ExecutionPolicy -Scope ...
-
- CategoryInfo : InvalidArgument: (:) [Set-ExecutionPolicy], ParameterBindingException
- fullyQualifiedErrorId:CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
(基础)PS C:\Windows\system32> Set-ExecutionPolicy -Scope MachinePolicy -ExecutionPolicy Unrestricted Set-ExecutionPolicy:无法设置执行策略。MachinePolicy 或 UserPolicy 范围内的执行策略必须通过组策略设置。在行:1 字符:1
- Set-ExecutionPolicy -Scope MachinePolicy -ExecutionPolicy Unrestricte ...
(基础)PS C:\Windows\system32> Set-ExecutionPolicy -Scope UserPolicy -ExecutionPolicy Unrestricted Set-ExecutionPolicy:无法设置执行策略。MachinePolicy 或 UserPolicy 范围内的执行策略必须通过组策略设置。在行:1 字符:1
- Set-ExecutionPolicy -Scope UserPolicy -ExecutionPolicy Unrestricted
(基础)PS C:\Windows\system32> Get-ExecutionPolicy -List
MachinePolicy Undefined UserPolicy Undefined Process Bypass CurrentUser Unrestricted LocalMachine RemoteSigned'''
powershell - In PowerShell: Virtual environment can't be loaded. States that file isn't digitally signed. However ExecutionPolicy is set to RemoteSigned
When I enter: Get-ExecutionPolicy it returns RemoteSigned yet I still can't activate my venv. I set ExecutionPolicy as administrator in powershell but it still doesn't impact my ability to run the virtual env. I have restarted vscode, and computer as well.
powershell - Windows Defender 和处理下载的 PowerShell 脚本
我使用Set-ExecutionPolicy RemoteSigned
并下载了一些脚本和模块。这些是我的脚本,所以它们没有签名。我可以使用Bypass
orRemoteSigned
或Unrestricted
. 我觉得这Unrestricted
有点过头了,所以我接受了RemoteSigned
,事实上,即使我的脚本没有签名,我也可以下载它们并运行它们......一段时间。然后,“Windows Defender”赶上并完全删除了我的脚本。我的问题是:
下载脚本后,是否有PowerShell 以编程方式指示 Windows Defender 在排除列表中标记该脚本?
你会说这
Unrestricted
有点不安全吗?如果是这样,使这些脚本签名(或自签名?)的过程是什么,或者这不可能?即设置为Unrestricted
使文件不被核弹,然后下载文件,然后以某种方式将其放在排除列表中,然后将 ExecutionPolicy 设置回RemoteSigned
?
powershell - 无法加载 PowerShell 脚本,因为已禁用运行脚本
我在我的电脑上运行脚本很好。它崩溃了,我得到了一个新的,我不断收到这个错误。(文件 C:\Users\19257\Desktop\DriveMaps.ps1 无法加载,因为在此系统上禁用了运行脚本。)所以,我知道脚本是否良好。它在其他人的计算机上运行。
我尝试过的。
- 已验证我的 PC 在正确的 AD OU 中。与其他可以运行脚本的人一样。
- 我以管理员身份运行 PowerShell 并尝试了这些命令并得到相同的错误。
Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
- 我的设置目前是这样的:
c++ - mpic++ 未定义对 tbb::task 的 typeinfo 的引用
我正在尝试使用std::sort(std::execution::par,x.begin(),x.end())
;所以我需要告诉编译器应该使用 c++17 或 c+20。在我的 make 文件中,我写道:
CXX_COMPILE=mpic++ -std=c++17 -fopenmp -Wall -Wextra -fPIC $(OPT_DEBUG) CXX_LINK=mpic++ -fPIC $(EXTRAFLAGS) $(OPT_DEBUG)
我得到了错误:
fatal error: tbb/blocked_range.h: No such file or directory
所以我安装了 tbb 并将 CXX_COMPILE 修改为:
CXX_COMPILE=mpic++ -ltbb -std=c++17 -fopenmp -Wall -Wextra -fPIC $(OPT_DEBUG)
编译这给了我一堆错误,告诉我:
Makefile有什么问题吗?
powershell - 尽管更新了 ExecutionPolicy,但无法在 VSCode 中激活虚拟环境
我正在尝试在 VSCode 中设置虚拟环境。
为此,我-m venv newproject
在 GitBash 中创建了一个文件夹“newproject”。
问题是我无法激活虚拟环境,因为在此系统上禁用了运行脚本(以下代码来自 VSCode 终端):
我觉得这很令人困惑,因为我尝试通过 Powershell 将执行策略设置为 admin 到 RemoteSigned 和 Unrestricted,但我仍然收到错误(以下代码来自 PowerShell):
尽管允许运行本地编写的脚本,为什么我仍然收到错误消息?
谢谢!