< Back

Test-CWindowsFeature

Sun Jan 12, 2020 11:35 pm

NAME Test-CWindowsFeature



SYNOPSIS

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





SYNTAX

Test-CWindowsFeature [-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-CWindowsFeature`.





PARAMETERS

-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-CWindowsFeature`.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Installed [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Test-CWindowsFeature -Name MSMQ-Server



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









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Test-CWindowsFeature -Name IIS-WebServer -Installed



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











RELATED LINKS

Get-CWindowsFeature

Install-CWindowsFeature

Uninstall-CWindowsFeature