当前位置:网站首页>运行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
问题解决
边栏推荐
猜你喜欢
![[some notes]](/img/91/7657f90b50f012736579b1585b4ade.jpg)
[some notes]

顺序表有关操作

Arm GIC (V) how arm TrustZone supports security interrupt analysis notes.

Switch basic experiment

晓看天色暮看云,美图欣赏

《MATLAB 神经网络43个案例分析》:第40章 动态神经网络时间序列预测研究——基于MATLAB的NARX实现

Onenet Internet of things platform - the console sends commands to mqtt product devices

Share several tools for designing exquisite circuit diagrams

IOS interview

第十四章 信号(四)- 多进程任务示例
随机推荐
Onenet Internet of things platform - the console sends commands to mqtt product devices
Circular linked list--
Operations related to sequence table
Huawei interview question: Recruitment
Ipv6-6to4 experiment
MySQL common functions
kubernetes之ingress探索实践
How to install php7 and perform performance test using yum
[datawhale202206] pytorch recommendation system: precision model deepfm & DIN
Efforts at the turn of the decade
2022-06-28-06-29
Digital signal processing -- Design of linear phase (Ⅱ, Ⅳ) FIR filter (2)
ustime写出了bug
顺序表有关操作
Chapter 14 signals (IV) - examples of multi process tasks
CPI tutorial - asynchronous interface creation and use
晓看天色暮看云,美图欣赏
硬阈值(Hard Thresholding)函数解读[通俗易懂]
A hole in solder paste
6.30 simulation summary