I have powershell 5.1 asdefault in windows 10 system, which supports 2.0 also. By passing "-version 2" I can use 2.0 powershell, but my requirement is to make 2.0 as default powershell version whenever I invoke a ps1 script. How to change the default powershell version?
PSv5 is part of the OS. So, no you cannot not do this. Many of the cmdlets on Win10 are specific to Win10 PSv5. So, even if you could do this, most of the cmdlets on the box would simply fail to work.
PSv2 is no longer supported, depreciated, and no longer being patched.
Future OS releases, it will be removed completely.
Why would you take this risk. MS has specifically said, that users should disable it and not use it. As has all of the risk focused industry. There is nothing that PSv2 provides that newer version cannot and there are a great many things that the newer versions provide the PSv2 cannot, and cannot be back ported.
You can always write your code to check for PS version installed and branch your code for the version you are targeting, with the cmdlets for that version, but this also requires you to have the list of cmdlets for all those legacy versions.
Leverage PSScriptAnalyzer for this, to help here. Note, PScriptAnalyzer will not work on v2 because it was never released for it.
Old PowerShell v2 code runs just fine on higher PS versions. A great many of the new cmdlets / modules / functions, will not run on v2.
The only reason PS2 is still there was backwards compat.
Resources for reasons not to use PSv2.