I'm looking for a sort of history lesson. I'm a latecomer to PowerShell. I learned on version 4 and I have a growing number of commandlets that I'm contemplating using in places where version compatibility matters. Most of my unit tests are passing when I run powershell -version 3
. On the other hand, there is a sea of red when I run powershell -version 2
. Rather than blindly reworking my code-base to try to make it friendly to pre-v4 versions of PowerShell, I'd like to get some sort of understanding what that would entail.
There are some posts that speak to some differences between versions, but I haven't found anything canonical, nor have I found any that take the retrospective perspective needed to undertake making a codebase backward compatible.
Here are my specific questions:
What are the major things missing from earlier versions of PowerShell that code written for later versions are probably relying on?
Are versions of PowerShell itself backward-compatible? That is, if a well-written script runs correctly on version 2, can I expect it to behave the same way when run on versions 3, 4, and 5?