No Soup, I Mean No PowerShell -Version 2 For You Windows 8 and Windows Server 2012

Be sure to start off by reading my previous blog article titled Error When Running PowerShell -Version 2 on Windows 8 and Windows Server 2012 if you have not previously read it since attempting to run PowerShell in version 2 mode generates an error on a default installation of Windows 8 or Windows Server 2012.

In PowerShell version 3, you can access PowerShell version 2 by running “PowerShell.exe -Version 2” (or “powershell -v 2”):

no-psv2-1.jpg

Windows 8 Release Preview

The PowerShell version 2 functionality is an optional feature that’s enabled by default:

no-psv2-2.jpg

PowerShell (or the GUI as shown above) can be used to display these optional features:

#Display the operating system version to show this is Windows 8 Release Preview:
(Get-CimInstance -ClassName Win32_OperatingSystem).Caption

#List the features that are currently enabled:
Get-WindowsOptionalFeature -Online | where State -EQ 'enabled'

no-psv2-252.jpg

The thing I don’t like about the Get-WindowsOptionalFeature cmdlet that I used in the previous example is that its FeatureName parameter doesn’t accept wildcards or an array of strings which makes that particular parameter almost useless:

no-psv2-261.jpg

It’s possibly to remove the PowerShell version 2 functionality by disabling those features:

Disable-WindowsOptionalFeature -Online -FeatureName 'MicrosoftWindowsPowerShellV2', 'MicrosoftWindowsPowershellV2Root'

no-psv2-3.jpg

At least the Disable-WindowsOptionalFeature cmdlet supports an array of strings so you can disable more than one feature at the same time. Enable-WindowsOptionalFeature also supports an array of strings.

no-psv2-31.jpg

Windows Server 2012 Release Candidate

PowerShell version 2 doesn’t show up in the GUI (if you performed the full GUI installation of the OS) as a feature that can be disabled, but it does show up in PowerShell:

#Display the operating system version to show this is Windows Server 2012 Release Candidate:
(Get-CimInstance -ClassName Win32_OperatingSystem).Caption

#List the features that start with PowerShell:
Get-WindowsFeature -Name PowerShell*

no-psv2-42.jpg

As with Windows 8, the PowerShell version 2 functionality can be disabled in Windows Server 2012 by disabling this feature:

no-psv2-51.jpg

My previous blog (referenced in the first paragraph of this blog) includes more information about the new Install-WindowsFeature and Uninstall-WindowsFeature cmdlets.

ยต