当前位置:网站首页>运行Powershell脚本提示“因为在此系统上禁止运行脚本”解决办法
运行Powershell脚本提示“因为在此系统上禁止运行脚本”解决办法
2022-07-01 12:36:00 【YYDataV数据可视化】
PS C:\Users\HP> cd .\Desktop\
PS C:\Users\HP\Desktop> '"Hello,Powershell Script"' > MyScript.ps1
PS C:\Users\HP\Desktop> .\MyScript.ps1
.\MyScript.ps1 : 无法加载文件 C:\Users\HP\Desktop\MyScript.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:
/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ .\MyScript.ps1
+ ~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\HP\Desktop> get-ExecutionPolicy
Restricted
PS C:\Users\HP\Desktop> set-ExecutionPolicy
位于命令管道位置 1 的 cmdlet Set-ExecutionPolicy
请为以下参数提供值:
ExecutionPolicy: RemoteSigned
执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170
中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”): Y
PS C:\Users\HP\Desktop> .\MyScript.ps1
Hello,Powershell Script
PS C:\Users\HP\Desktop>运行get-ExecutionPolicy提示Restricted说明是被限制了
运行set-ExecutionPolicy,输入remotesigned,再输入Y
问题解决
边栏推荐
- kubernetes之ingress探索实践
- 腾讯总考epoll, 很烦
- 项目部署,一点也不难!
- Tencent Li Wei: deeply cultivate "regulatory technology" to escort the steady and long-term development of the digital economy
- [Suanli network] technological innovation of Suanli Network -- key technology of operation service
- Indefinite integral
- ANSI/UL 94 VTM薄质材料垂直燃烧测试
- leetcode:226. 翻转二叉树【dfs翻转】
- 【脑洞大开】《西潮》及《走向世界丛书》
- 题目 1004: 母牛的故事(递推)
猜你喜欢

Mobile note application

Onenet Internet of things platform - mqtt product equipment upload data points

队列操作---

Ansible相关内容梳理
![[20211129] jupyter notebook remote server configuration](/img/7c/79c9fcb91bde75e954dc3ecf9f5afd.png)
[20211129] jupyter notebook remote server configuration

Queue operation---
![[Suanli network] technological innovation of Suanli Network -- key technology of operation service](/img/80/6e3648c88d309516d4bc29db9c153c.jpg)
[Suanli network] technological innovation of Suanli Network -- key technology of operation service

MySQL workbench data modeling function

Double linked list related operations

Indefinite integral
随机推荐
[20211129] jupyter notebook remote server configuration
使用BurpSuite对app抓包教程
List of QT players [easy to understand]
项目部署,一点也不难!
[shell programming] - shell introductory learning
BIM and safety in road maintenance-buildSmart Spain
Stack-------
[JS] interview questions
Blue Bridge Cup multi interface switching processing (enumeration plus state machine method)
系统测试UI测试总结与问题(面试)
网络socket的状态要怎么统计?
Share several tools for designing exquisite circuit diagrams
Tencent Li Wei: deeply cultivate "regulatory technology" to escort the steady and long-term development of the digital economy
Leetcode (Sword finger offer) - 58 - ii Rotate string left
[20211129] configuration du serveur distant du carnet de notes jupyter
Mobile note application
Eurake partition understanding
fatal error: execution: 没有那个文件或目录
Blocking sockets的读写操作该怎么玩?
编译调试Net6源码