To display a comprehensive list of Windows features and their subfeatures using PowerShell, you should use the
Get-WindowsFeature cmdlet. By default, this command returns all installed and available features on the server. To specifically view hierarchical relationships or filter for specific roles like Hyper-V, you can pipe the output to
Where-Object or format it with
Format-Table. This approach ensures you see both parent roles and their dependent components clearly in the console.
Understanding Get-WindowsFeature Basics
The
Get-WindowsFeature cmdlet is part of the ServerManager module, which is pre-installed on Windows Server operating systems. When you run this command without any parameters, it queries the local machine's component store and registry to retrieve a list of all possible features. The output includes several key columns:
Name, which is the technical identifier used by PowerShell;
Display Name, which is the human-readable label shown in the GUI; and
Installed, a boolean value indicating if the feature is currently active.
For administrators managing Windows Server 2019, understanding this structure is vital because many features are nested. For example, the "Hyper-V" role contains subfeatures like Hyper-V Management Tools and Hyper-V Platform Service. Without proper formatting, the raw output can be overwhelming. Therefore, the first step is often to limit the scope of the query to make the data digestible.
Filtering Features for Specific Roles
One of the most common tasks is isolating a specific role to inspect its subfeatures. You can achieve this by using the
-Name parameter or by filtering the results after retrieval. For instance, if you want to see all subfeatures related to Hyper-V, you can run the following command:
Get-WindowsFeature -Name *Hyper-V*
This command uses wildcard characters to match any feature name containing "Hyper-V". The result will show the main Hyper-V role along with every associated subfeature. If you need to verify the installation state of these specific items, look at the
Installed column. A checkmark indicates an active installation, while a blank space means it is available but not installed.
If you prefer a more programmatic approach, you can filter the entire list using
Where-Object. This is useful when you are scripting automated checks. The following example filters for features where the name starts with "Hyper-V":
Get-WindowsFeature | Where-Object { $_.Name -like "Hyper-V*" }
This method provides greater flexibility, allowing you to combine multiple conditions. For example, you could filter for features that are not yet installed but are required for a specific setup. This technique is particularly helpful when preparing a new server deployment and you need to ensure all prerequisites are accounted for before proceeding.
Formatting the Output for Readability
Raw text output from
Get-WindowsFeature can sometimes truncate long display names or make it difficult to distinguish between parent roles and child features. To improve readability, especially when exporting reports or viewing them in a remote session, you should use
Format-Table. This cmdlet allows you to select specific columns and adjust the width of the display.
A common pattern is to display the Name, Display Name, and Installed status side-by-side:
Get-WindowsFeature | Format-Table -AutoSize Name, DisplayName, Installed
The
-AutoSize flag ensures that the table adjusts to fit your console window, preventing horizontal scrolling issues. This is particularly important when dealing with a large number of features. Additionally, you can sort the output by the
Installed property to quickly identify which features are active versus those that are dormant. Sorting helps in auditing the server configuration efficiently.
For deeper analysis, you might want to export this data to a CSV file for further review in Excel. Using
Export-Csv preserves the structure of the data:
Get-WindowsFeature | Select-Object Name, DisplayName, Installed | Export-Csv -Path "C:\Features.csv" -NoTypeInformation
This creates a structured dataset that can be analyzed offline. It is a best practice to maintain such records for compliance and documentation purposes. If you are working in a virtualized environment, checking feature states is crucial before provisioning new VMs. You might find it useful to cross-reference this with guides on
Enable Auto Logon in Windows 10 VM inside Hyper-V using PowerShell to ensure your host environment is fully configured.
Common Use Cases and Best Practices
Administrators often use
Get-WindowsFeature during initial server setup or routine maintenance. One frequent scenario is verifying that a specific update or security patch has enabled a particular feature. Another is troubleshooting performance issues. If you suspect that unnecessary features are running in the background, listing them helps identify candidates for removal.
However, caution is advised when removing features. Always verify dependencies before uninstalling a role. Removing a parent feature will automatically remove its subfeatures, but the reverse is not always true. Some subfeatures may be shared across different roles. Therefore, it is wise to document your changes. If you experience sluggish performance after making changes, refer to resources on
Troubleshooting Sluggish Performance of PowerShell Scripts in Hyper-V on Windows 10 to diagnose potential bottlenecks.
Another best practice is to use the
-ComputerName parameter if you need to check features on a remote server. This requires appropriate permissions and WinRM configuration. It streamlines management across multiple servers without needing to log into each one individually. This capability is essential for enterprise environments where consistency is key.
Frequently Asked Questions
How do I check if a specific subfeature is installed?
You can check the installation status of a specific feature by piping the output of
Get-WindowsFeature to
Where-Object and filtering by the exact name. Look for the
Installed column in the result, which will show a checkmark if the feature is present.
Can I use Get-WindowsFeature on Windows 10?
No,
Get-WindowsFeature is only available on Windows Server operating systems. On client versions like Windows 10, you must use
Get-WindowsOptionalFeature instead, as the underlying component store structure differs.
Why is my Get-WindowsFeature output truncated?
The default output may truncate long display names or exceed the console width. Using
Format-Table -AutoSize or exporting to CSV resolves this by adjusting the layout or saving the full data string.
How do I remove a feature using PowerShell?
To remove a feature, use the
Remove-WindowsFeature cmdlet followed by the feature name. Ensure you have administrative privileges and confirm that no critical dependencies rely on the feature being removed.
Is there a way to install multiple features at once?
Yes, you can pass an array of feature names to the
Add-WindowsFeature cmdlet. This allows for bulk installation, which is efficient for setting up new servers with standard configurations.