Powershell脚本的4种执行权限介绍
2019/7/10 21:22:42
本文主要是介绍Powershell脚本的4种执行权限介绍,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
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脚本的4种执行权限介绍的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2022-09-14SharePoint 2019 用 PowerShell将启用发布功能站点网站集另存为模板
- 2022-08-30PowerShell教程 - 程序性能和BUG分析工具
- 2022-08-30PowerShell教程 - 模块管理(Modules Management)
- 2022-08-29PowerShell教程 - Web requests(Web请求)
- 2022-08-26PowerShell教程 - 日期时间管理(Date & Time Management)
- 2022-08-25PowerShell教程 - 磁盘与硬件管理(Disk & Hardware Management)
- 2022-08-25PowerShell教程 - 系统事件管理(System Event Management)
- 2022-08-25PowerShell教程 - 文件系统管理(File System Management)
- 2022-08-24PowerShell教程 - 网络管理(Network Management)
- 2022-08-24PowerShell