Use Windows PowerShell to install optional features

Martin Brinkmann
Jul 14, 2017
Updated • Nov 14, 2019
Windows, Windows 10
|
14

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.

This works well for the most part, but requires that you open the Control Panel on the operating system unless you load the Features window directly by typing optionalfeatures in Start.

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.

Windows PowerShell: install optional features

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.

List all optional features and their status

powershell optional features

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

  • FeatureName : Printing-PrintToPDFServices-Features
  • FeatureName : Windows-Defender-Default-Definitions
  • FeatureName : Printing-XPSServices-Features
  • FeatureName : SearchEngine-Client-Package
  • FeatureName : MSRDC-Infrastructure
  • FeatureName : TelnetClient
  • FeatureName : TFTP
  • FeatureName : TIFFIFilter
  • FeatureName : WorkFolders-Client
  • FeatureName : LegacyComponents
  • FeatureName : DirectPlay
  • FeatureName : Printing-Foundation-Features
  • FeatureName : FaxServicesClientPackage
  • FeatureName : Printing-Foundation-InternetPrinting-Client
  • FeatureName : Printing-Foundation-LPDPrintService
  • FeatureName : Printing-Foundation-LPRPortMonitor
  • FeatureName : SimpleTCP
  • FeatureName : MicrosoftWindowsPowerShellV2Root
  • FeatureName : MicrosoftWindowsPowerShellV2
  • FeatureName : Windows-Identity-Foundation
  • FeatureName : Microsoft-Windows-Subsystem-Linux
  • FeatureName : HypervisorPlatform
  • FeatureName : VirtualMachinePlatform
  • FeatureName : Client-ProjFS
  • FeatureName : NetFx4-AdvSrvs
  • FeatureName : NetFx4Extended-ASPNET45
  • FeatureName : IIS-WebServerRole
  • FeatureName : IIS-WebServer
  • FeatureName : IIS-CommonHttpFeatures
  • FeatureName : IIS-HttpErrors
  • FeatureName : IIS-HttpRedirect
  • FeatureName : IIS-ApplicationDevelopment
  • FeatureName : IIS-NetFxExtensibility
  • FeatureName : IIS-NetFxExtensibility45
  • FeatureName : IIS-HealthAndDiagnostics
  • FeatureName : IIS-HttpLogging
  • FeatureName : IIS-LoggingLibraries
  • FeatureName : IIS-RequestMonitor
  • FeatureName : IIS-HttpTracing
  • FeatureName : IIS-Security
  • FeatureName : IIS-URLAuthorization
  • FeatureName : IIS-RequestFiltering
  • FeatureName : IIS-IPSecurity
  • FeatureName : IIS-Performance
  • FeatureName : IIS-HttpCompressionDynamic
  • FeatureName : IIS-WebServerManagementTools
  • FeatureName : IIS-ManagementScriptingTools
  • FeatureName : IIS-IIS6ManagementCompatibility
  • FeatureName : IIS-Metabase
  • FeatureName : WAS-WindowsActivationService
  • FeatureName : WAS-ProcessModel
  • FeatureName : WAS-NetFxEnvironment
  • FeatureName : WAS-ConfigurationAPI
  • FeatureName : IIS-HostableWebCore
  • FeatureName : IIS-StaticContent
  • FeatureName : IIS-DefaultDocument
  • FeatureName : IIS-DirectoryBrowsing
  • FeatureName : IIS-WebDAV
  • FeatureName : IIS-WebSockets
  • FeatureName : IIS-ApplicationInit
  • FeatureName : IIS-ASPNET
  • FeatureName : IIS-ASPNET45
  • FeatureName : IIS-ASP
  • FeatureName : IIS-CGI
  • FeatureName : IIS-ISAPIExtensions
  • FeatureName : IIS-ISAPIFilter
  • FeatureName : IIS-ServerSideIncludes
  • FeatureName : IIS-CustomLogging
  • FeatureName : IIS-BasicAuthentication
  • FeatureName : IIS-HttpCompressionStatic
  • FeatureName : IIS-ManagementConsole
  • FeatureName : IIS-ManagementService
  • FeatureName : IIS-WMICompatibility
  • FeatureName : IIS-LegacyScripts
  • FeatureName : IIS-LegacySnapIn
  • FeatureName : IIS-FTPServer
  • FeatureName : IIS-FTPSvc
  • FeatureName : IIS-FTPExtensibility
  • FeatureName : WCF-Services45
  • FeatureName : WCF-HTTP-Activation45
  • FeatureName : WCF-TCP-Activation45
  • FeatureName : WCF-Pipe-Activation45
  • FeatureName : WCF-MSMQ-Activation45
  • FeatureName : WCF-TCP-PortSharing45
  • FeatureName : MSMQ-Container
  • FeatureName : MSMQ-Server
  • FeatureName : MSMQ-Triggers
  • FeatureName : MSMQ-ADIntegration
  • FeatureName : MSMQ-HTTP
  • FeatureName : MSMQ-Multicast
  • FeatureName : MSMQ-DCOMProxy
  • FeatureName : WCF-HTTP-Activation
  • FeatureName : WCF-NonHTTP-Activation
  • FeatureName : IIS-CertProvider
  • FeatureName : IIS-WindowsAuthentication
  • FeatureName : IIS-DigestAuthentication
  • FeatureName : IIS-ClientCertificateMappingAuthentication
  • FeatureName : IIS-IISCertificateMappingAuthentication
  • FeatureName : IIS-ODBCLogging
  • FeatureName : NetFx3
  • FeatureName : SMB1Protocol
  • FeatureName : SMB1Protocol-Client
  • FeatureName : SMB1Protocol-Server
  • FeatureName : SMB1Protocol-Deprecation
  • FeatureName : MediaPlayback
  • FeatureName : WindowsMediaPlayer
  • FeatureName : Microsoft-Windows-NetFx3-OC-Package
  • FeatureName : Microsoft-Windows-NetFx4-US-OC-Package
  • FeatureName : Microsoft-Windows-Client-EmbeddedExp-Package
  • FeatureName : Microsoft-Windows-NetFx3-WCF-OC-Package
  • FeatureName : Microsoft-Windows-NetFx4-WCF-US-OC-Package
  • FeatureName : Containers-DisposableClientVM
  • FeatureName : Microsoft-Hyper-V-All
  • FeatureName : Microsoft-Hyper-V
  • FeatureName : Microsoft-Hyper-V-Tools-All
  • FeatureName : Microsoft-Hyper-V-Management-PowerShell
  • FeatureName : Microsoft-Hyper-V-Hypervisor
  • FeatureName : Microsoft-Hyper-V-Services
  • FeatureName : Microsoft-Hyper-V-Management-Clients
  • FeatureName : HostGuardian
  • FeatureName : Client-DeviceLockdown
  • FeatureName : Client-EmbeddedShellLauncher
  • FeatureName : Client-EmbeddedBootExp
  • FeatureName : Client-EmbeddedLogon
  • FeatureName : Client-KeyboardFilter
  • FeatureName : Client-UnifiedWriteFilter
  • FeatureName : DataCenterBridging
  • FeatureName : DirectoryServices-ADAM-Client
  • FeatureName : Windows-Defender-ApplicationGuard
  • FeatureName : ServicesForNFS-ClientOnly
  • FeatureName : ClientForNFS-Infrastructure
  • FeatureName : NFS-Administration
  • FeatureName : Containers
  • FeatureName : SmbDirect
  • FeatureName : MultiPoint-Connector
  • FeatureName : MultiPoint-Connector-Services
  • FeatureName : MultiPoint-Tools
  • FeatureName : AppServerClient
  • FeatureName : Internet-Explorer-Optional-amd64

Display information about features

powershell-display information about features

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.

Enable or disable an optional feature

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:

  • Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -All -- This command installs the Net Framework 3.5 on the computer the command is run on.
  • Disable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -- This command disables the feature again.

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.

PowerShell

For Windows

Resources

Summary
Use Windows PowerShell to install optional features
Article Name
Use Windows PowerShell to install optional features
Description
The following guide provides you with an overview on how to manage, enable or disable optional features using PowerShell on Windows 10.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. taersious said on September 21, 2020 at 10:35 pm
    Reply

    Has any support been added for later versions of .Net, for example 4.6?
    I see these options available when I use the GUI “Add Roles and Features Wizard” but they do not appear when I perform a “Get-WindowsOptionalFeature” listing.

  2. simo said on March 25, 2018 at 8:01 pm
    Reply

    Hello,

    We are working on Windows 10 Entreprise deployment.
    I see They so many features. is there any way to find which features to enable and which to disable en entreprise environnement (best practices)

    Thank you

  3. maxxxa said on October 17, 2017 at 1:28 pm
    Reply

    its on windows 8+
    for oldest win :
    dism /online /get-features

    help and another command ( enable , disable, clear etc ) :
    dism /online /?

  4. Franck said on October 17, 2017 at 12:19 pm
    Reply

    Thanks a lot !

  5. Andrés Rosero said on August 30, 2017 at 7:04 pm
    Reply

    Eres un fucking maestro, no podía activar el DirectPlay de DirectX en Windows 10 (lite version) para jugar GTA San Andreas. Gracias a tu tutorial únicamente tuve que colocar en el PowerShell:

    enable-windowsoptionalfeature -online -featurename “DirectPlay” -All

    Mil gracias camarada! ;-)

  6. dmacleo said on July 15, 2017 at 8:24 pm
    Reply

    https://technet.microsoft.com/en-us/library/dn482068.aspx

    some programs that server 2008r2, 2012, 2012r2, 2012r2 essentials may need may need .net 3.5 so powershell needed to install

    also anyone running exchange server 2013 (and I think 2010) uses exchange powershell a bunch

  7. Chuck said on July 15, 2017 at 1:39 pm
    Reply

    As Walter Matthau would say “Holy Moly”. If you think it doesn’t exist….it does. lol

  8. CHEF-KOCH said on July 15, 2017 at 7:10 am
    Reply

    You can start/stop dnscache manually via registry.

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters

    DWORD32 ‘Start’ 4 is enabled.

    or via ‘net stop dnscache’.

    This is only on your end, usually when ipconfig /flushdns cache is or was used it takes time for dnscache to resolve the list. Instead of using MS own DNSCache I highly recommend to use Unbound instead (unbound.net).

    1. mark said on July 15, 2017 at 4:33 pm
      Reply

      Both donot work with this build

  9. Anonymous said on July 15, 2017 at 6:36 am
    Reply

    Or you can install the ransomware yourself.

  10. TianlanSha said on July 14, 2017 at 1:22 pm
    Reply

    Wow, those are a lot of features. I’m guessing if I don’t know what they do I don’t need them?

    1. Martin Brinkmann said on July 14, 2017 at 2:27 pm
      Reply

      Many of them are specialized features that you need only when you want to run or do certain things.

      1. kebin said on July 14, 2017 at 6:13 pm
        Reply

        Martin w10 b16241build disabled the ability to stop/disable dnscache service.
        Any news on why?

        How can we disable it?

        any powershell commands for permanently disabling it?

      2. Martin Brinkmann said on July 14, 2017 at 6:38 pm
        Reply

        I have no information on that, but since this is a preview build, it could be a bug and not intended. Just checked and sc stop does not work on the command line.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.