Yesterday, I used the new -Runasadministrator #requires statement and I failed to mention that it’s only available on Powershell version 4.0.
Today, I’ve tried to determine how bad I failed and actually learned something new.
I’ve got surprised by the fact that the PSversion is showing 4.0 although I launched Powershell using a specific version (3.0 in my case).
I did the same with version 2.0 and I got the following message that was expected.
I added the missing component with the following command:
Enable-WindowsOptionalFeature -Online -FeatureName 'NetFx3'
Now, version 2.0 is loaded
Why was powershell loading version 4.0 although I specified 3.0?
Well the answer can be found in the release notes of the preview