Powershell中禁止执行脚本解决办法(about_Execution_Policies)
来源:互联网 发布:淘宝怎么做虚拟产品 编辑:程序博客网 时间:2024/06/06 17:54
Powershell中禁止执行脚本解决办法 - 张善友 - 博客园 http://www.cnblogs.com/shanyou/archive/2011/09/03/2165371.html
Powershell中禁止执行脚本解决办法(about_Execution_Policies)
刚开始使用Powershell,导入管理模块或者其他操作的时候会出现因为在此系统中禁止执行脚本的报错,报错内容如下:
Windows PowerShell版权所有 (C) 2009 Microsoft Corporation。保留所有权利。PS C:\Windows\system32> D:\Workshop\Powershell\Sprinkler\src\Scripts\SPRINKLE.ps1无法加载文件 D:\Workshop\Powershell\Sprinkler\src\Scripts\SPRINKLE.ps1,因为在此系统中禁止执行脚本。有关详细信息,请参阅 "get-help about_signing"。所在位置 行:1 字符: 58+ D:\Workshop\Powershell\Sprinkler\src\Scripts\SPRINKLE.ps1 <<<< + CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId : RuntimeException
PS C:\Windows\system32> get-ExecutionPolicy (查询当前策略设置)
Restricted (guyue: 受限制的)
果然,是被限制。还是在"get-help about_signing"里面可以查到设置命令"set-executionpolicy"
再在帮助中找到"set-executionpolicy"的说明。。似乎是比较建议设置为,至少是被标记为可信任的
-- RemoteSigned: Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
在PowerShell执行以下:
PS C:\Windows\system32> set-ExecutionPolicy RemoteSigned(修改策略以执行prowershell脚本)
执行策略更改
执行策略可以防止您执行不信任的脚本。更改执行策略可能会使您面临 about_Execution_Policies
帮助主题中所述的安全风险。是否要更改执行策略?
[Y] 是(Y) [N] 否(N) [S] 挂起(S) [?] 帮助 (默认值为“Y”): y
之后即可执行prowershell脚本, 例如
PS C:\Windows\system32>./1.ps1(执行脚本)
- Powershell中禁止执行脚本解决办法(about_Execution_Policies)
- powershell中禁止执行脚本解决办法
- Powershell中禁止执行脚本解决办法
- powershell中禁止执行脚本解决办法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell中出现”禁止执行脚本“的解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell-2.解决禁止本地执行脚本
- PowerShell提示系统禁止执行脚本解决方法
- C#中执行PowerShell 脚本
- C#中执行PowerShell 脚本
- PowerShell 无法加载文件ps1,因为在此系统中禁止执行脚本
- powershell-无法加载文件,因为在此系统中禁止执行脚本。
- powershell-无法加载文件,因为在此系统中禁止执行脚本
- PowerShell因为在此系统中禁止执行脚本问题的解决方法
- POWERSHELL脚本执行权限
- 第十三周项目-项目3-形状类族的纯虚函数
- 最大子数组和
- 解决KeSetTimer定时精度不够方法
- JAVA基础之运算符
- 一个简单求和函数的matlab实现(带程序耗时功能)
- Powershell中禁止执行脚本解决办法(about_Execution_Policies)
- 欢迎使用CSDN-markdown编辑器
- promise应用示例讲解
- JAVA入门 新手看类与对象
- Structs2 命名空间
- JAVA基础之程序流程控制:判断结构
- TCP/IP详解(五)---IP选路
- 模式识别(Pattern Recognition)学习笔记(十一)--SVM支持向量机(狭义):大间隔
- LeetCode题解(一)