Can you simulate PowerShell v3 after installing v4?

I want to emulate PowerShell 3.0

From PowerShell v3 or v4, you can emulate v2 with this command:

%windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe -version 2

$ Host shows: Version: 2.0

However in PowerShell 4

%windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe -version 3

$ Host now reports: Version: 4.0 (I was hoping for 3: 0)

Question: Is there a way to emulate PowerShell 3.0 from 4.0?

+4
source share
1 answer

No, It is Immpossible. V4 is backward compatible with V3, so any script written by targeting V3 will work just fine with V4.

If you want to write scripts that support V3 and V4, it is best to use a machine / virtual machine with V3 to make sure that you do not rely on V4 features.

+6

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


All Articles