Powershell中禁止执行脚本解决办法
2011-09-03 14:06
519 查看
刚开始使用Powershell,导入管理模块或者其他操作的时候会出现因为在此系统中禁止执行脚本的报错,报错内容如下:
PS C:\Windows\system32> get-ExecutionPolicy
Restricted
果然,是被限制。还是在"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
执行策略更改
执行策略可以防止您执行不信任的脚本。更改执行策略可能会使您面临 about_Execution_Policies
帮助主题中所述的安全风险。是否要更改执行策略?
[Y] 是(Y)
否(N) [S] 挂起(S) [?] 帮助 (默认值为“Y”): y
PS C:\Windows\system32>
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
果然,是被限制。还是在"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
执行策略更改
执行策略可以防止您执行不信任的脚本。更改执行策略可能会使您面临 about_Execution_Policies
帮助主题中所述的安全风险。是否要更改执行策略?
[Y] 是(Y)
否(N) [S] 挂起(S) [?] 帮助 (默认值为“Y”): y
PS C:\Windows\system32>
相关文章推荐
- powershell中禁止执行脚本解决办法
- Powershell中禁止执行脚本解决办法
- Powershell中禁止执行脚本解决办法
- Powershell中禁止执行脚本解决办法
- powershell中禁止执行脚本解决办法
- Powershell中禁止执行脚本解决办法(about_Execution_Policies)
- Powershell中禁止执行脚本解决办法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell中出现”禁止执行脚本“的解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell-2.解决禁止本地执行脚本
- PowerShell提示系统禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本的解决方法
- PowerShell因为在此系统中禁止执行脚本问题的解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- php脚本输出js代码不执行的解决办法和原理。