powershell - 每次运行 powershell 脚本时都会出现 Set-ExecutionPolicy 错误
问题描述
每当我运行 powershell 脚本时,我都会收到错误消息:
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".
当我在 Powershell ISE 中运行脚本或在命令行上运行命令时,不会发生这种情况。有没有办法阻止这种情况发生?
解决方案
如错误消息中所述,您可以检查Get-ExecutionPolicy -List
所有策略。更详细的范围级别会覆盖更一般的级别。
就我而言,我通过在进程级别设置执行策略来解决它。
Set-Executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
推荐阅读
- java - 由于无效的升级标头,Spring Boot Websockets 握手失败:null
- java - 我想在字符串的arrayList 上调用计算方法。为每个元素并行调用此方法将节省时间。有办法吗?
- c# - 在 c# 中为使用 AzureAd 登录的当前用户获取 Jwt 令牌
- python-sphinx - 狮身人面像不承认≤,≥?
- ubuntu - 在 Ubuntu 18.04 LTS 中构建 px4_sitl 时出错
- json - 如何将图像文件传递到 Flutter 中的 Http 请求(POST)正文?
- php - 为什么 php/apache 停止读取 $_REQUEST 变量
- delphi - 如何防止 RAD studio 自动添加 Android 属性?
- mariadb - 寻找 MySQL Workbench 的替代品以与 MariaDB 10 一起使用
- wordpress - 为 wp-admin 创建站点地图