Test-WindowsFeature

Tests if an optional Windows component exists and, optionally, if it is installed.

Syntax

Test-WindowsFeature [-Name] <String> [-Installed] [-WhatIf] [-Confirm] [<CommonParameters>]

Description

Feature names are different across different versions of Windows. This function tests if a given feature exists. You can also test if a feature is installed by setting the Installed switch.

Feature names are case-sensitive and are different between different versions of Windows. For a list, on Windows 2008, run serveramanagercmd.exe -q; on Windows 7, run Get-WmiObject -Class Win32_OptionalFeature | Select-Object Name. On Windows 8/2012, use Get-WindowsFeature.

Related Commands

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String

The name of the feature to test. Feature names are case-sensitive and are different between different versions of Windows. For a list, on Windows 2008, run serveramanagercmd.exe -q; on Windows 7, run Get-WmiObject -Class Win32_OptionalFeature | Select-Object Name. On Windows 8/2012, use Get-WindowsFeature.

true false
Installed SwitchParameter

Test if the service is installed in addition to if it exists.

false false False
WhatIf SwitchParameter false false
Confirm SwitchParameter false false
CommonParameters This cmdlet supports common parameters. For more information type
Get-Help about_CommonParameters.

EXAMPLE 1

Test-WindowsFeature -Name MSMQ-Server

Tests if the MSMQ-Server feature exists on the current computer.

EXAMPLE 2

Test-WindowsFeature -Name IIS-WebServer -Installed

Tests if the IIS-WebServer features exists and is installed/enabled.