您现在的位置是:网站首页> 编程资料编程资料
Powershell脚本的4种执行权限介绍_PowerShell_
2023-05-26
322人已围观
简介 Powershell脚本的4种执行权限介绍_PowerShell_
Restricted——默认的设置, 不允许任何script运行
AllSigned——只能运行经过数字证书签名的script
RemoteSigned——运行本地的script不需要数字签名,但是运行从网络上下载的script就必须要有数字签名
Unrestricted——允许所有的script运行
windows默认不允许任何脚本运行,你可以使用"Set-ExecutionPolicy"cmdlet来改变的你PowerShell环境。例如,你可以使用如下命令让PowerShell运行在无限制的环境之下:
复制代码 代码如下:
Set-ExecutionPolicy Unrestricted
但在win7下,必须使用管理员的权限启动命令命令行,否则会报“Set-ExecutionPolicy : 对注册表项“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell”的访问被拒绝。”错误。
使用java调用powershell脚本,可以使用以下命令:
复制代码 代码如下:
String cmd = "cmd /c powershell -ExecutionPolicy RemoteSigned -noprofile -noninteractive -file \""+ scriptFilename + "\"";
您可能感兴趣的文章:
相关内容
- PowerShell中的转义字符是什么?_PowerShell_
- PowerShell批量文件重命名操作实例_PowerShell_
- PowerShell中以管理员权限启动应用程序的方法_PowerShell_
- PowerShell中的函数重载示例_PowerShell_
- PowerShell中获取当前运行脚本路径的方法_PowerShell_
- PowerShell中使用.NET将程序集加入全局程序集缓存_PowerShell_
- PowerShell实现参数互斥示例_PowerShell_
- PowerShell实现动态获取当前脚本运行时消耗的内存_PowerShell_
- PowerShell Continue语句使用示例_PowerShell_
- PowerShell实现按条件终止管道的方法_PowerShell_
