当前位置:网站首页>运行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
问题解决
边栏推荐
- 顺序表有关操作
- 单点登录SSO与JWT好文整理
- 6.30模拟赛总结
- Teach you to complete the actual battle of image classification hand in hand -- Image Recognition Based on convolutional neural network
- 腾讯安全发布《BOT管理白皮书》|解读BOT攻击,探索防护之道
- Good luck brought by years of persistence
- Tencent Li Wei: deeply cultivate "regulatory technology" to escort the steady and long-term development of the digital economy
- 6.30 simulation summary
- localtime居然不可重入,踩坑了
- Wechat simulated geographical location_ Camouflage wechat location
猜你喜欢
Sleep quality today 79 points
Mobile note application
Sort out relevant contents of ansible
被锡膏坑了一把
项目部署,一点也不难!
[20220605] Literature Translation -- visualization in virtual reality: a systematic review
JS reverse | m3u8 data decryption of a spring and autumn network
第十四章 信号(四)- 多进程任务示例
VS Code 设置代码自动保存
循环链表--
随机推荐
Indefinite integral
(混更一篇)多个txt文本转一个表格
ASTM D 3801 vertical burning test of solid plastics
Huawei interview question: Recruitment
Compile and debug net6 source code
项目部署,一点也不难!
买卖其实也有风险
[speech signal processing] 3 speech signal visualization -- prosody
微信小程序 – 80个实用的微信小程序项目实例
Ipv6-6to4 experiment
CPI教程-异步接口创建及使用
被锡膏坑了一把
[some notes]
Ansible Playbook
ASTM D 3801固体塑料垂直燃烧试验
A hole in solder paste
用.Net Core接入微信公众号开发
腾讯安全发布《BOT管理白皮书》|解读BOT攻击,探索防护之道
哪个券商公司开户佣金低又安全又可靠
Ansi/ul 94 VTM vertical burning test for thin materials