Get WindowsFeature - PowerShell


Overview

Get-WindowsFeature enables you to retrieve and manage Windows features, which are optional software components that can be installed or removed to customize the functionality of Windows systems. It provides detailed information about installed and available features, allowing you to assess system capabilities and make informed decisions about feature management.

Syntax

Get-WindowsFeature [-Name] <string[]> [-Prefix <string>] [-Required <boolean>] [-Optional <boolean>] [-Installed <boolean>]
                      [-Available <boolean>] [-ComputerName <string>] [-Detailed] [-Wildcards <boolean>]

Options/Flags

  • -Name: Specifies the exact name(s) of the Windows feature(s) you want to retrieve information about.
  • -Prefix: Filters features based on a prefix within the feature name.
  • -Required: Specifies whether to include only required features in the results.
  • -Optional: Specifies whether to include only optional features in the results.
  • -Installed: Specifies whether to include only installed features in the results.
  • -Available: Specifies whether to include only features available for installation in the results.
  • -ComputerName: Specifies the remote computer from which you want to retrieve feature information.
  • -Detailed: Displays additional information about each feature, including description, display name, and installation state.
  • -Wildcards: Allows the use of wildcard characters (*) in feature names for wildcard matching.

Examples

Example 1: Get Installed Features

Get-WindowsFeature -Installed

Example 2: Find Features Containing “Hyper”

Get-WindowsFeature -Prefix Hyper

Example 3: Get Detailed Information About Specific Features

Get-WindowsFeature -Name .NETFramework-Core-WindowsDesktop, Hyper-V -Detailed

Common Issues

  • Error fetching remote features: Verify that you have administrative privileges and that Windows Remote Management (WinRM) is enabled on the remote computer.
  • Incorrect feature name: Confirm that you have specified the correct feature name. Use Get-WindowsFeature -Available to view available features.
  • Unavailable features: Some features may not be available for installation on your system due to hardware or software limitations.

Integration

Get-WindowsFeature can be integrated with other PowerShell commands for advanced tasks:

  • Install-WindowsFeature: Use the results from Get-WindowsFeature to target specific features for installation.
  • Uninstall-WindowsFeature: Remove installed features using the names retrieved with Get-WindowsFeature.
  • Get-WindowsOptionalFeature: Retrieve information about optional features using a similar syntax.