惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
T
Tenable Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Privacy & Cybersecurity Law Blog
C
Cisco Blogs
A
Arctic Wolf
T
Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
Spread Privacy
Spread Privacy
D
Darknet – Hacking Tools, Hacker News & Cyber Security
N
News and Events Feed by Topic
SecWiki News
SecWiki News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 聂微东
Scott Helme
Scott Helme
S
Securelist
AWS News Blog
AWS News Blog
Hacker News: Ask HN
Hacker News: Ask HN
美团技术团队
博客园 - 叶小钗
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
博客园_首页
H
Hacker News: Front Page
博客园 - 【当耐特】
J
Java Code Geeks
宝玉的分享
宝玉的分享
Jina AI
Jina AI
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cloudbric
Cloudbric
N
News and Events Feed by Topic
爱范儿
爱范儿
月光博客
月光博客
TaoSecurity Blog
TaoSecurity Blog
V
Visual Studio Blog
T
Troy Hunt's Blog
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
S
Secure Thoughts
L
LINUX DO - 热门话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - Franky
G
Google Developers Blog
Schneier on Security
Schneier on Security

博客园 - 蔡秋心

Windows Azure VM的两种shut down 方式 转贴: A Simple c# Wrapper for ffMpeg PowerShell: 找到一个目录下最新的文件 在localhost上使用fiddler 在SQL Server Business Intelligence Development Studio中编辑Dynamcis CRM中的Report Report Design: Best Practices and Guidelines Visual Studio使用小技巧6 – 为代码加上Using(Resolve using)和管理Using(Organize using) Visual Studio使用小技巧5 – 区块选择(box selection)的拷贝(copy)和粘贴(paste) Visual Studio使用小技巧4 – Where am I(在Solution Explorer中显示当前文档) Visual Studio使用小技巧3 – 标签分组(Tab Group)和分割窗口(Split window) Visual Studio使用小技巧2 – 使用任务列表(task list) - 补充 Visual Studio使用小技巧2 – 使用任务列表(task list) Visual Studio使用小技巧1 – HTML编辑器中的格式化 部署Dotnetnuke Site到虚拟目录和端口不为80的网站 asp.net使用COM组件需要的权限设置 前台线程(Foreground Threads)和后台线程(Background Threads) 在Dynamics CRM 的 Entity Form中显示记录的ID的方法 如何使用VS2005创建web安装包 使用Visual Studio中的Item Template
PowerShell: 如何解决File **.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get- help about_sig" for more de
蔡秋心 · 2012-09-21 · via 博客园 - 蔡秋心

PowerShell 默认不允许执行*.ps1脚本文件。运行ps1文件会得到下面的错误:

File C:\Temp\Test.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get- help about_signing" for more details.

At line:1 char:19
+ c:\Temp\Test.ps1 <<<<

可以通过Get-ExecutionPolicy,来取得当前策略。

用Set-ExecutionPolicy设置当前策略。

下面的命令可以解决上面的错误

PS C:\Windows\system32> Set-ExecutionPolicy RemoteSigned  <按回车>

Execution Policy Change

The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose 

you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution

policy?

[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):<按Y>

 在PowerShell中的执行

Policy的有效参数:

-- Restricted:  不载入任何配置文件,不运行任何脚本。 "Restricted" 是默认的。

-- AllSigned: 只有被Trusted publisher签名的脚本或者配置文件才能使用,包括你自己再本地写的脚本

-- RemoteSigned:  对于从Internet上下载的脚本或者配置文件,只有被Trusted publisher签名的才能使用。

-- Unrestricted: 可以载入所有配置文件,可以运行所有脚本文件. 如果你运行一个从internet下载并且没有签名的脚本,在运行之前,你会被提示需要一定的权限。

-- Bypass: 所有东西都可以使用,并且没有提示和警告.

-- Undefined: 删除当前scope被赋予的Execution Policy.  但是Group Policy scope的Execution Policy不会被删除.