Bre*_*tra 14 windows powershell
我尝试为我的 powershell 环境创建一个终极设置。
我用一堆语句创建了“Microsoft.PowerShell_profiles.ps1”来设置我的默认配置文件。
但是,当我开始 PowerShell 会话时,我得到:
File C:\Documents and Settings\xxx\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 cannot be loaded.
The file C:\Documents and Settings\xxx\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 is not digitally signed. The script will not execute on the system.
squ*_*man 18
默认情况下,Powershell 会限制您运行“不安全”脚本。运行该get-executionpolicy命令以查看您的系统级别。要降低限制,您可以运行Set-ExecutionPolicy并为其提供以下其中一项作为参数:
还可以阅读 Scott Hanselman 关于签署 Powershell 脚本的智慧之言。
最简单的解决方案是
Set-ExecutionPolicy RemoteSigned
Run Code Online (Sandbox Code Playgroud)
但这将运行本地磁盘上的所有脚本(并且不在远程区域中 - 例如通过 IE 下载)