PowerShell: 如何解决File **.ps1 cannot be loaded because the execution of scripts is disabled on this sy
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不会被删除.
PowerShell: 如何解决File **.ps1 cannot be loaded because the execution of scripts is disabled on this sy的更多相关文章
- PS1--cannot be loaded because the execution of scripts is disabled on this system
在nagiosXI上,通过nsclient++ 引用plugin “check_ms_win_disk_load”(https://outsideit.net/check-ms-win-disk-lo ...
- PowerShell “execution of scripts is disabled on this system.”
Set-ExecutionPolicy RemoteSigned
- Powershell profile.ps1 cannot be loaded because its operation is blocked by software restriction policies
Powershell profile.ps1 cannot be loaded because its operation is blocked by software restriction pol ...
- jquery解决file上传图片+图片预览
js解决file上传图片+图片预览 demo案例中代码为js原生控制,可以根据项目的需求修改为jquery操作 <!DOCTYPE html><html lang="en& ...
- Powershell cannot be loaded because running scripts is disabled on this system 解决办法
问题背景 第一次跑ps时,出现了下面的提示.这是因为windows不允许执行脚本而已,不要大惊小怪. 解决办法 这个需要管理员执行,不然会出现以下的情况 正常情况
- ng : File C:\Users\baron\AppData\Roaming\npm\ng.ps1 cannot be loaded because running
一. Windos PowerShell 选择 管理员身份运行二.set-ExecutionPolicy RemoteSigned 然后更改权限为A 三.get-ExecutionPolicy 查看当 ...
- SharePoint 2007 Full Text Searching PowerShell and CS file content with SharePoint Search
1. Ensure your site or shared folder in one Content Source. 2. Add file types. 3. The second step in ...
- 解决File.delete()删除不掉文件
首先注意两点: 此文件被使用的时候无法删除(比如网络输出没关闭流) 判断此文件是否存在再做删除(exists) 删除文件夹之前先删除文件夹下的所有文件(递归解决) 判断是否删除成功会有返回值,文件名错 ...
- 分享我编写的powershell脚本:ssh-copy-id.ps1
问:通过[字符串界面].如何从win,通过ssh,连接到sshd?答:在任意版本win中,通过cmd.exe,powershell.exe中调用ssh.exe,连接sshd. 问:通过[pow ...
随机推荐
- axd与ashx区别
简单说明一下axd文件.axd文件实际上并不是在硬盘上存在的文件,而是HttpHandler的一种映射.在ASP.NET MVC中有很多内置的axd到ashx的映射.你可以在web.config中通过 ...
- UVA11388 GCD LCM(数论)
题目链接. 题意: 给定两个数,一个G,一个L,找出两个数a,b(a<=b),使得这两个数的最大公约数为G,最小公倍数为L,且(a最小). 分析: 当a,b存在时,a一定为G. 自己证了一下,数 ...
- BZOJ1715: [Usaco2006 Dec]Wormholes 虫洞
1715: [Usaco2006 Dec]Wormholes 虫洞 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 475 Solved: 263[Sub ...
- Yarn应用程序运行流程剖析
Yarn(Yet Another Resource Negotiator)是一个Hadoop集群资源管理系统,Hadoop2时被引入,旨在提高MapReduce的性能,但YARN已足够通用,使得它可以 ...
- COCI2014-2015CONTEST#7——POLICE
http://www.hsin.hr/coci/archive/2014_2015/contest7_tasks.pdf [题目描述] 有N个书架,每个书架可以容纳M本书.给出了若干本书,每本书有一个 ...
- Windows 7 中未能从程序集System.ServiceModel
Windows 7 中未能从程序集System.ServiceModel “/”应用程序中的服务器错误. 未能从程序集“System.ServiceModel, Version=3.0.0.0 ...
- 【3】JAVA---地址App小软件(AddPanel.class)(表现层)
添加地址信息界面. 年龄和地址必须是数字,否则会弹出窗口提示. 地址信息不能为空. /* * AddPanel.java * * Created on __DATE__, __TIME__ */ pa ...
- Spring 整合 Tibco EMS
参考文档: http://haohaoxuexi.iteye.com/blog/1893038 http://www.blogjava.net/chenhui7502/archive/2011/08 ...
- sts 去掉启动的rss功能
STS(spring tools suite) 每次开启都显示,比较烦人,可以在设置中禁用掉,具体方法:window->Perferences,然后查找dashboard,将启动时展示dashb ...
- css中居中的居中方法
1:给div设置一个宽度,然后添加margin:0 auto属性 div{ width:200px; margin:0 auto; } 2:居中一个浮动元素 确定容器的宽高 宽500 高 300 的层 ...