手机
当前位置:查字典教程网 >脚本专栏 >PowerShell >Powershell脚本的4种执行权限介绍
Powershell脚本的4种执行权限介绍
摘要:Restricted——默认的设置,不允许任何script运行AllSigned——只能运行经过数字证书签名的scriptRemoteSig...

Restricted——默认的设置, 不允许任何script运行

AllSigned——只能运行经过数字证书签名的script

RemoteSigned——运行本地的script不需要数字签名,但是运行从网络上下载的script就必须要有数字签名

Unrestricted——允许所有的script运行

windows默认不允许任何脚本运行,你可以使用"Set-ExecutionPolicy"cmdlet来改变的你PowerShell环境。例如,你可以使用如下命令让PowerShell运行在无限制的环境之下:

复制代码 代码如下:

Set-ExecutionPolicy Unrestricted

但在win7下,必须使用管理员的权限启动命令命令行,否则会报“Set-ExecutionPolicy : 对注册表项“HKEY_LOCAL_MACHINESOFTWAREMicrosoftPowerShell1ShellIdsMicrosoft.PowerShell”的访问被拒绝。”错误。

使用java调用powershell脚本,可以使用以下命令:

复制代码 代码如下:

String cmd = "cmd /c powershell -ExecutionPolicy RemoteSigned -noprofile -noninteractive -file ""+ scriptFilename + """;

【Powershell脚本的4种执行权限介绍】相关文章:

Powershell中打开网页实例

Powershell脚本中使用条件断点实例

Windows Powershell 介绍和安装

PowerShell脚本清理指定天数前的临时文件夹实现代码

探索PowerShell(十三) WMI对象介绍

PowerShell中的强类型数组介绍

Powershell Profiles配置文件的存放位置介绍

Powershell小技巧之找出脚本中的错误

PowerShell脚本中查看网卡的高级属性

Powershell检查网站响应并计算执行时间例子

精品推荐
分类导航