powershell - 如何从 Powershell 4 指向 Powershell 版本 3?

标签 powershell powershell-3.0 powershell-4.0

我正在使用 Powershell v4。

通过键入以下命令,我可以切换到 PowershellV2。

Powershell -Version 2



但下面的不起作用。它保留在 Powershell v4 中。

Powershell -Version 3



如何从 v4 切换到 Powershell v3?背后的原因如下。

在我们的客户环境中,Powershell v3 将存在,并且他们不会为此版本迁移到 .Net 4.5.2(这意味着他们不能转到 Powershell v4)。但在我们的环境中,我们已经升级。现在我们想在 v3 环境中测试我们的脚本。

最佳答案

我想这是设计使然。

https://technet.microsoft.com/en-us/library/hh847736.aspx

Applies To: Windows PowerShell 2.0, Windows PowerShell 3.0, Windows PowerShell 5.0

-Version <Windows PowerShell Version>

Starts the specified version of Windows PowerShell. The version that you specify must be installed on the system. If Windows PowerShell 3.0 is installed on the computer, valid values are "2.0" and "3.0". The default value is "3.0".

If Windows PowerShell 3.0 is not installed, the only valid value is "2.0". Other values are ignored.

关于powershell - 如何从 Powershell 4 指向 Powershell 版本 3?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33696272/

相关文章:

windows - 用于重新启动网络适配器的简单 Powershell 脚本变得不容易在受限用户帐户上工作

powershell - 为虚拟机分配保留 IP

powershell - CSV文件按col1分组并显示col2的最大值

powershell - 使用 Powershell 阅读 Gmail 电子邮件

powershell - 并行运行Quest cmdlet并将输出保存到文件

powershell - 如何将 Export-CSV 链接到 Send-MailMessage 而不必在 PowerShell 中将 CSV 保存到磁盘?

powershell - 如何使用 Powershell 验证保留 IP

powershell - 根据用户名输入变量断开RDS用户

powershell - 在PowerShell中将变量传递到语句 block 括号中

电源外壳。计算文件中重复条目的数量