Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any easy way to check backward compatibility for powershell scripts?

I have written a powershell script and it should work both in version 1 and version 2.

Can more than one powershell versions co-exist in a single machine ? Or should i have powershell versions in separate machine ?

like image 720
Samselvaprabu Avatar asked Oct 25 '12 08:10

Samselvaprabu


People also ask

Are PowerShell scripts backwards compatible?

Windows PowerShell is forward compatible. This means a script that I wrote in Windows PowerShell 1.0 will run without problems in Windows PowerShell 5.0.

Is PowerShell 7.2 backwards compatible?

Backward compatibility As PowerShell 7 is now based on . NET Framework Core 3.1, it offers enhanced backward compatibility with Windows PowerShell modules.

Can we downgrade PowerShell version?

We can downgrade a manually upgraded PowerShell version by removing the corresponding Windows Management Framework (WMF) package.


1 Answers

Well, the answer is yes and no.

Technically, on PowerShell 2.0 system, you can access PowerShell version 1.0 using

-version 1

parameter of powershell.exe

Similarly, on PowerShell 3.0 system, you can acccess PowerShell verison 2.0 using

-version 2

You cannot have both installed seperately on the same machine. PowerShell itself provides a way to go to the earlier version.

like image 134
ravikanth Avatar answered Oct 06 '22 22:10

ravikanth