首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用powershell 1.0版执行策略时出错

使用powershell 1.0版执行策略时出错
EN

Stack Overflow用户
提问于 2017-09-13 18:13:05
回答 2查看 226关注 0票数 0

Iam使用以下命令在服务器上静默安装service pack

代码语言:javascript
复制
 H:\>powershell.exe -executionpolicy bypass -noninteractive -nologo -file path\SP_Ins
tallation.ps1   ax-riscvmsql68\sql68  d:\sysdba\SQLServer2008SP4-KB2979596-x64-E
NU.exe 2>&1

在powershell 4.0版上运行此命令时,iam未收到任何错误

当iam在1.0版本上运行相同的命令时,它给出了以下错误

代码语言:javascript
复制
H:\>powershell.exe -executionpolicy bypass -noninteractive -nologo -file path\SP_Installation.ps1   ax-riscvmsql68\sql68  d:\sysdba\SQLServer2008SP4-KB2979596-x64-ENU.exe 2>&1
Missing expression after unary operator '-'.
At line:1 char:2
+ -e <<<< xecutionpolicy bypass -noninteractive -nologo -file path\SP_Installation.ps1 ax-riscvmsql68\sql68 d:\sysdba\SQLServer2008SP4-KB2979596-x64-ENU.exe

您能帮我解决一下吗,因为powershell 1.0版不能识别执行策略

EN

回答 2

Stack Overflow用户

发布于 2017-09-13 22:16:37

根据this article的说法

在Powershell v1.0中,您只能使用restrictedremotesignedAllsignedunrestricted

  • Restricted

不要加载配置文件或运行脚本。这是default.

  • AllSigned

要求所有脚本和配置文件都由受信任的发行者签名,包括在loca l computer.

  • RemoteSigned上编写的脚本

要求从互联网下载的所有脚本和配置文件都由受信任的publisher.

  • Unrestricted签名

加载所有配置文件并运行所有脚本。如果运行从internet下载的未签名脚本,则在运行之前会提示您输入权限。

正如@Ansgar Wiechers所说的,请远离v1.0...它非常过时,大多数系统都使用v3.0或更高版本。与其他更新版本相比,v1.0中不提供某些命令和特性。

票数 0
EN

Stack Overflow用户

发布于 2017-09-21 14:46:06

因此这是一个解决方案,您不能使用powershell版本1.0来执行策略主机需要在powershell版本2.0 +上

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46194790

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档