What reasons do powershell -version 2 fail?

I have run PowerShell v3 several times on several different systems. Sometimes I want to check compatibility or other issues with v2, so I switch to v2 in existing PowerShell using this:

PS> powershell -version 2 

Of course, I use either $hosts.Version or $PSVersionTable to perform a health check. But on the same machine, when I did this, they both reported that I was still in the V3 shell. I tried again from scratch; same result. I also tried calling it from a DOS shell instead of PowerShell; again, the same result. Then, to test my own sanity (!), I went to another system, did the same sequence and worked as expected - I really switched from V3 to V2 environment.

The only other observation I have is that on the system that worked, I received a copyright notice in 2009 when it launched the inner shell; in a system that did not show this 2012.

The final detail: of the two machines mentioned, it worked on Win8 and failed at the Win7 enterprise, but I really doubt that this is an important factor here.

I would be very surprised if (a) this is a PS error or (b) I am the only one who sees the problem, but the web search turned out to be fruitless for me in this way. Any thoughts on why this might be happening?

+4
source share
2 answers

One of the reasons is that .NET 2.0 is not installed on a fault-tolerant system, I cannot remember whether it should be installed before v3, or you can install it after upgrading to version 3.

+1
source

A quick search revealed this, just an idea? Maybe V2 is not installed?

Is version 2 installed?

+1
source

Source: https://habr.com/ru/post/1495562/


All Articles