Microsoft Windows ships with a set of so-called optional features that users may enable or disable using the "turn Windows features on or off" control panel applet.
While that is sufficient most of the time, administrators may use PowerShell as well to manage optional features of the Windows operating system.
The following guide provides you with an overview on how that works on Windows 10. Note that this may not work on previous versions of Windows such as Windows 7.
You need an elevated PowerShell for the following commands. Tap on the Windows-key, type powershell, hold down the Ctrl-key and the Shift-key, and tap on the Enter-key to open a PowerShell prompt with administrative privileges.
The first thing you may want to do, at least when you are new to using the command, is to display the list of features that are available.
Run get-windowsoptionalfeature -online to list all available feature names and their states on the computer system. The state is either enabled or disabled.
Note: the -online parameter means that the actions are run on the current device.
While it is easy enough to identify some features by the feature name, it is not easy for all of them.
The following list is from a Windows 10 Pro version 1809
You may use the -featurename Example parameter to display detailed information about a feature that you are interested in.
The command get-windowsoptionalfeature -online -featurename NetFx3 for instance reveals that this installs the .Net Framework 3.5 on the system. There is also an Internet link provided that you may click on to look up additional information online.
You may use PowerShell commands to enable or disable optional features on a Windows 10 machine.
The commands Enable-WindowsOptionalFeature -FeatureName and Disable-WindowsOptionalFeature -FeatureName are used for that.
To give you two examples to show you how that works:
The -All parameter tells Windows to install any dependencies as well. So, if a parent feature is required for the installation of the selected feature, it is installed as well. Note: Disable does not support the -All parameter.
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.