powershell-无法加载文件,因为在此系统中禁止执行脚本
2014-06-01 13:50
706 查看
写了一个powershell脚本测试脚本,结果执行的时候报错 $a=Get-Content C:\script.txt | select-string -pattern "ora" if ( $a -eq $null ) { write-host "error" } else { write-host "OK" } PS D:\> .\pshell.ps1 无法加载文件 D:\pshell.ps1,因为在此系统中禁止执行脚本。有关详细信息,请参阅 "get-help about_signing"。 所在位置 行:1 字符: 13 + .\pshell.ps1 <<<< + CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId : RuntimeException 查明了原因是由于操作系统默认禁止执行脚本,执行一次set-executionpolicy remotesigned后脚本顺利执行 关于Set-ExecutionPolicy详细信息 Set-ExecutionPolicy 可更改 Windows PowerShell 执行策略的用户首选项。要在 Windows Vista、Windows Server 2008 和 Windows 的更高版本上运行此命令,必须使用\"以管理员身份运行\"选项启动 Windows PowerShell,即使您是计算机上 Administrators 组的成员,执行策略是 Windows PowerShell 安全策略的一部分。它确定是否可以加载配置文件(包括 Windows PowerShell 配置文件)和运行脚本,并且确定哪些脚本(如果有)在运行之前必须进行数字签名
相关文章推荐
- powershell-无法加载文件,因为在此系统中禁止执行脚本
- powershell-无法加载文件,因为在此系统中禁止执行脚本。
- PowerShell 无法加载文件ps1,因为在此系统中禁止执行脚本
- powershell-无法加载文件,因为在此系统中禁止执行脚本
- Powershell直接脚本时出现无法加载文件因为禁止执行脚本
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本的解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本问题的解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- PowerShell因为在此系统中禁止执行脚本解决方法
- vmware vsphere powercli 因为在此系统中禁止执行脚本
- 转:VMware vSphere PowerCLI 因为在此系统中禁止执行脚本。有关详细信息,请参阅
- PowerShell:因为在此系统上禁止运行脚本
- PowerShell提示,因为此系统中禁止执行脚本
- PowerShell提示系统禁止执行脚本解决方法
- 运行powershell 脚本 在此系统上禁止运行脚本