How to Query and Manage Windows Optional Features in Windows 11 Using PowerShell

Windows 11 includes dozens of modular operating system components that are not enabled by default. These range from development and virtualisation frameworks—such as Hyper-V, Windows Subsystem for Linux (WSL), and Windows Sandbox—to legacy administrative tools like Telnet Client, TFTP Client, and Internet Information Services (IIS). While users can toggle these tools using the classic Turn Windows features on or off Control Panel applet, system administrators and power users frequently require a scriptable, unattended method to audit and configure operating system capabilities across single machines or entire PC fleets.

Windows PowerShell provides native cmdlets through the Deployment Image Servicing and Management (DISM) module, allowing you to query, enable, and remove Windows optional features and on-demand capabilities directly from the console. In this technical tutorial, you will learn how to list available features, install optional tools without reboot loops, and automate feature provisioning in Windows 11.

Understanding Optional Features vs. Features on Demand (Capabilities)

In Windows 11, modular system packages are divided into two distinct technical categories:

  • Windows Optional Features: Core operating system components that reside locally within the Windows component store (WinSxS). Examples include Microsoft-Hyper-V-All, Containers, and VirtualMachinePlatform. These are managed using Get-WindowsOptionalFeature, Enable-WindowsOptionalFeature, and Disable-WindowsOptionalFeature.
  • Windows Capabilities (Features on Demand / FOD): Standalone software packages that are often downloaded dynamically from Windows Update or injected via enterprise WSUS repositories when requested. Examples include the OpenSSH Server, Remote Server Administration Tools (RSAT), Paint, and Notepad. These are managed using Get-WindowsCapability, Add-WindowsCapability, and Remove-WindowsCapability.

Step 1: Open an Elevated PowerShell Session

Configuring system features modifies the Windows component store and requires administrative privileges. Press Windows Key + X and choose Terminal (Admin) or search for PowerShell in the Start menu, right-click it, and select Run as administrator.

Step 2: Querying Installed and Available Windows Optional Features

To inspect every optional feature registered in your Windows 11 installation, execute the following command:

Get-WindowsOptionalFeature -Online

The -Online parameter instructs PowerShell to query the currently running operating system rather than an offline WIM/VHD image.

Because the default output produces an extensive list, pipe the results into Where-Object to filter exclusively for currently enabled features:

Get-WindowsOptionalFeature -Online | Where-Object { $_.State -eq "Enabled" } | Select-Object FeatureName, State | Format-Table -AutoSize

To search for a specific capability by keyword (for example, finding all virtualisation or sandbox features):

Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -like "*Hyper*" -or $_.FeatureName -like "*Sandbox*" } | Select-Object FeatureName, State

Step 3: Enabling an Optional Feature

To activate a disabled feature, pass the exact FeatureName to the Enable-WindowsOptionalFeature cmdlet.

For example, to enable Windows Sandbox (which provides a clean, disposable desktop environment):

Enable-WindowsOptionalFeature -Online -FeatureName "Containers-DisposableClientVM" -All

Key parameters to note:

  • -FeatureName: The technical identifier discovered during your query.
  • -All: Automatically activates any parent or prerequisite components required for the feature to function properly.
  • -NoRestart: Suppresses automatic system restart prompts, which is essential when executing automation scripts across multiple installations.

If you are enabling a feature that requires a reboot to finalise installation, PowerShell will indicate RestartNeeded : True in the console output.

Step 4: Disabling an Optional Feature

If you no longer require a specific component or want to eliminate potential security attack surfaces (such as legacy SMB 1.0 protocols), disable the feature using:

Disable-WindowsOptionalFeature -Online -FeatureName "SMB1Protocol" -NoRestart

The feature will be deactivated, and its active binaries will be unlinked from the running kernel while remaining preserved within WinSxS for future restoration.

Step 5: Managing Windows Capabilities (Features on Demand)

For modular tools classified under Features on Demand (FOD), such as OpenSSH or RSAT administration suites, use the Get-WindowsCapability family of cmdlets.

To list all available capabilities and their current installation status:

Get-WindowsCapability -Online | Select-Object Name, State | Format-Table -AutoSize

To install a specific capability (such as OpenSSH Server):

Add-WindowsCapability -Online -Name "OpenSSH.Server~~~~0.0.1.0"

To remove an unneeded capability and reclaim disk storage:

Remove-WindowsCapability -Online -Name "OpenSSH.Server~~~~0.0.1.0"

Exporting a Complete System Feature Audit Report

For compliance auditing, system hardening reviews, or disaster recovery documentation, you can export a complete CSV inventory of all enabled features and capabilities:

$FeatureAudit = Get-WindowsOptionalFeature -Online | Select-Object FeatureName, State
$FeatureAudit | Export-Csv -Path "$HOME\Desktop\Windows11_Features_Audit.csv" -NoTypeInformation

This spreadsheet can be retained to ensure standard build consistency across new workstation deployments.

Troubleshooting Common Feature Installation Errors

  • Error 0x800f081f (The Source Files Could Not Be Found): This occurs if the required installation files have been purged from the local WinSxS store and group policy blocks the machine from downloading binaries directly from Windows Update. You can specify a local Windows installation ISO or WIM file as a source:
    Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -Source "D:\sources\sxs" -LimitAccess
  • RestartNeeded Blocks Additional Installations: If a previously installed feature requires a system restart, subsequent feature installations will fail with exit codes indicating a pending restart. Reboot the PC before proceeding with additional changes.
  • Hyper-V Virtualisation Extensions Disabled: Attempting to enable Hyper-V on systems where Intel VT-x or AMD-V is disabled in the motherboard UEFI firmware will cause the installation or virtualisation hypervisor boot to fail. Ensure hardware virtualisation is enabled in your BIOS/UEFI settings.

Frequently Asked Questions

Does disabling a Windows Optional Feature free up hard drive space?

Standard optional features disabled via Disable-WindowsOptionalFeature remain cached in the C:\Windows\WinSxS folder so they can be re-enabled without installation media. However, removing Windows Capabilities via Remove-WindowsCapability often deletes the payload files completely, freeing up local drive space.

Can I manage Windows Optional Features on offline disk images?

Yes. Instead of the -Online flag, pass the -Path parameter pointing to a mounted Windows image directory (e.g. Get-WindowsOptionalFeature -Path "C:\Mount\OfflineImage").

Why is Hyper-V not listed on Windows 11 Home edition?

The native Hyper-V hypervisor feature (Microsoft-Hyper-V-All) is restricted to Windows 11 Pro, Enterprise, and Education editions. While Windows Subsystem for Linux (WSL) and the Virtual Machine Platform are supported on Home editions, the full Hyper-V management stack requires a Pro licence.

What is the difference between DISM.exe and PowerShell DISM cmdlets?

The underlying servicing engine is identical. However, PowerShell cmdlets return structured objects that can be filtered with Where-Object, sorted, looped across machines, and exported directly to CSV or JSON, whereas DISM.exe outputs raw unformatted text.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.