Error When Running PowerShell -Version 2 on Windows 8 and Windows Server 2012

Windows 8 Release Preview

On a fresh installation of the Windows 8 Release Preview, when attempting to run PowerShell.exe -Version 2, you’ll receive the following error:

“Version v2.0.50727 of the .NET Framework is not installed and it is required to run version 2 of Windows PowerShell.”

The following error message is generated if you attempt to run the same command from the PowerShell ISE:

“powershell : V e r s i o n v 2 . 0 . 5 0 7 2 7 o f t h e . N E T F r a m e w o r k
i s n o t i n s t a l l e d a n d i t i s r e q u i r e d t o r u n
v e r s i o n 2 o f W i n d o w s P o w e r S h e l l .
At line:1 char:1
+ powershell -v 2
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (V e r s i o n … r S h e l l . :String) [], Remote
+ FullyQualifiedErrorId : NativeCommandError”

The solution is to enable the .NET Framework 3.5 feature:

You’ll need Internet access to enable this feature because the source files don’t exist on the machine (the State is “DisabledWithPayloadRemoved”):

I’m glad to see the new Get-WindowsOptionalFeature, Enable-WindowsOptionalFeature, and Disable-WindowsOptionalFeature cmdlets in Windows 8 so I no longer have to use Deployment Image Servicing and Management (DISM) command line commands:

Once the .NET Framework feature is enabled, PowerShell -Version 2 works without issue:

Windows Server 2012 Release Candidate

The same issue exists in both the Server Core & GUI installation of Windows Server 2012:

The resolution is also the same, enable the .NET Framework 3.5 feature:

Whether these features are installed or not can also be determined in PowerShell:

The strange thing about this issue on Server 2012 is the “PowerShell-V2” feature shows as being removed without any changes being made to a default installation of Windows Server 2012. One other interesting bit of information is shown in the following screenshot, unlike Windows Server 2008 R2, the PoweShell ISE is installed by default on a 2012 Server when a GUI installation is performed:

Other than the ISE not being installed, these options are the same on 2012 Server Core:

Once the “NET-Framework-Core” feature is enabled, Powershell v2 works without issue:

Notice that I used the Install-WindowsFeature cmdlet in the previous example. The Install-WindowsFeature and Uninstall-WindowsFeature cmdlets are new to Server 2012 and replace the Add-WindowsFeature and Remove-WindowsFeature cmdlets. The old cmdlet names are now aliases to these new cmdlets:

When the ‘NET-Framework-Core” feature is enabled, it also appears to enable the “PowerShell-V2” feature:

I decided to test further since there’s no logical reason adding the .NET Framework should enable the PowerShell version 2 feature. I removed both the “NET-Framework-Core” and “Powershell-V2” features:

After restarting as specified in the previous step, I enabled the “NET-Framework-Core” feature which did not automatically enable the “PowerShell-V2” feature. My guess is the “PowerShell-V2” feature didn’t show up as being enabled before because of the missing .NET Framework prerequisite and once that prerequisite was added, it showed as enabled.

I removed both features again and added just the “PowerShell-V2” feature and as expected, it automatically enabled the “NET-Framework-Core” prerequisite feature:


Leave a Reply

%d bloggers like this: