Published in Articles on by Michiel van Oosterhout ~ 2 min read

Windows has many optional features, like a hypervisor, web server, and even a Telnet client. These optional features can be enabled or disabled using the Turn Windows features on or off applet (C:\Windows\System32\OptionalFeatures.exe), or using Windows PowerShell.

Turn Windows features on or off
Turn Windows features on or off

To get a complete list of optional features available in Windows, run Get-WindowsOptionalFeature -Online | %{ "$($_.FeatureName) ($($_.State))" } | sort. Then use Enable-WindowsOptionalFeature and/or Disable-WindowsOptionalFeature to enable and/or disable features. The -Online parameter in these commands specifies the running operating system on your local computer. Some features may require a restart. This is indicated in their RestartNeeded property.

The Windows PowerShell script below enables the .NET Framework 3.0 feature and disables the Work Folders Client. This script requires an elevated Windows PowerShell session, and a restart is needed after running it.

# Ensure the DISM module is loaded
Import-Module DISM

# Define the features to be enabled
$features = @(
    "NetFx3" # .NET Framework 3.5 (includes .NET 2.0 and 3.0)
)

# Enable optional Windows features
$features | ForEach-Object {
    Enable-WindowsOptionalFeature -FeatureName $_ -NoRestart -Online
}

# Define the features to be disabled
$features = @(
    "WorkFolders-Client" # Work Folders Client
)

# Disable optional Windows features
$features | ForEach-Object {
    Disable-WindowsOptionalFeature -FeatureName $_ -NoRestart -Online
}

For a list of optional Windows features and their -FeatureName value, see this note.

Summary

Windows 11's optional features can be enabled or disabled using Windows PowerShell, although a restart may be needed depending on the features enabled or disabled.