I\'d like to use .NET in some PowerShell scripts I\'m about to write -- how do I know/declare which version of .NET I\'m dealing with when these scripts run?
And is
To get the .NET version:
[System.Reflection.Assembly]::GetExecutingAssembly().ImageRuntimeVersion
...which is, by default, the version of the CLR the assembly (System.Management.Automation.dll) compiled under.
System.Management.Automation.dll
And no, you cannot choose which .NET version you can run the script under.