Use Windows PowerShell to install optional features

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 1703 PC.

FeatureName : Microsoft-Windows-HyperV-Guest-Package
FeatureName : LegacyComponents
FeatureName : DirectPlay
FeatureName : SimpleTCP
FeatureName : SNMP
FeatureName : WMISnmpProvider
FeatureName : MicrosoftWindowsPowerShellV2Root
FeatureName : MicrosoftWindowsPowerShellV2
FeatureName : Windows-Identity-Foundation
FeatureName : Microsoft-Windows-Subsystem-Linux
FeatureName : NetFx3
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 : WCF-HTTP-Activation
FeatureName : WCF-NonHTTP-Activation
FeatureName : WCF-Services45
FeatureName : WCF-HTTP-Activation45
FeatureName : WCF-TCP-Activation45
FeatureName : WCF-Pipe-Activation45
FeatureName : WCF-MSMQ-Activation45
FeatureName : WCF-TCP-PortSharing45
FeatureName : IIS-CertProvider
FeatureName : IIS-WindowsAuthentication
FeatureName : IIS-DigestAuthentication
FeatureName : IIS-ClientCertificateMappingAuthentication
FeatureName : IIS-IISCertificateMappingAuthentication
FeatureName : IIS-ODBCLogging
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 : MSMQ-Container
FeatureName : MSMQ-Server
FeatureName : MSMQ-Triggers
FeatureName : MSMQ-ADIntegration
FeatureName : MSMQ-HTTP
FeatureName : MSMQ-Multicast
FeatureName : MSMQ-DCOMProxy
FeatureName : NetFx4-AdvSrvs
FeatureName : NetFx4Extended-ASPNET45
FeatureName : MediaPlayback
FeatureName : WindowsMediaPlayer
FeatureName : Printing-PrintToPDFServices-Features
FeatureName : Printing-XPSServices-Features
FeatureName : RasRip
FeatureName : MSRDC-Infrastructure
FeatureName : SearchEngine-Client-Package
FeatureName : TelnetClient
FeatureName : TFTP
FeatureName : Xps-Foundation-Xps-Viewer
FeatureName : WorkFolders-Client
FeatureName : SMB1Protocol
FeatureName : Microsoft-Hyper-V-All
FeatureName : Microsoft-Hyper-V-Tools-All
FeatureName : Microsoft-Hyper-V-Management-Clients
FeatureName : Microsoft-Hyper-V-Management-PowerShell
FeatureName : Microsoft-Hyper-V
FeatureName : Microsoft-Hyper-V-Hypervisor
FeatureName : Microsoft-Hyper-V-Services
FeatureName : Printing-Foundation-Features
FeatureName : Printing-Foundation-LPRPortMonitor
FeatureName : Printing-Foundation-LPDPrintService
FeatureName : Printing-Foundation-InternetPrinting-Client
FeatureName : FaxServicesClientPackage
FeatureName : ScanManagementConsole
FeatureName : DirectoryServices-ADAM-Client
FeatureName : ServicesForNFS-ClientOnly
FeatureName : ClientForNFS-Infrastructure
FeatureName : NFS-Administration
FeatureName : RasCMAK
FeatureName : SmbDirect
FeatureName : Containers
FeatureName : DataCenterBridging
FeatureName : TIFFIFilter
FeatureName : Client-DeviceLockdown
FeatureName : Client-EmbeddedShellLauncher
FeatureName : Client-EmbeddedBootExp
FeatureName : Client-EmbeddedLogon
FeatureName : Client-KeyboardFilter
FeatureName : Client-UnifiedWriteFilter
FeatureName : MultiPoint-Connector
FeatureName : MultiPoint-Connector-Services
FeatureName : MultiPoint-Tools
FeatureName : Internet-Explorer-Optional-amd64

Read also:  Windows 10 Fall Creators Update: Limit Windows Update bandwidth

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.

Resources

Summary
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
Please share this article

Facebooktwittergoogle_plusredditlinkedinmail


Filed under:


Responses to Use Windows PowerShell to install optional features

  1. TianlanSha July 14, 2017 at 1:22 pm #

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

    • Martin Brinkmann July 14, 2017 at 2:27 pm #

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

      • kebin July 14, 2017 at 6:13 pm #

        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?

      • Martin Brinkmann July 14, 2017 at 6:38 pm #

        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.

  2. Anonymous July 15, 2017 at 6:36 am #

    Or you can install the ransomware yourself.

  3. CHEF-KOCH July 15, 2017 at 7:10 am #

    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).

    • mark July 15, 2017 at 4:33 pm #

      Both donot work with this build

  4. Chuck July 15, 2017 at 1:39 pm #

    As Walter Matthau would say "Holy Moly". If you think it doesn't exist....it does. lol

  5. dmacleo July 15, 2017 at 8:24 pm #

    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

  6. Andrés Rosero August 30, 2017 at 7:04 pm #

    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! ;-)

  7. Franck October 17, 2017 at 12:19 pm #

    Thanks a lot !

  8. maxxxa October 17, 2017 at 1:28 pm #

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

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

Leave a Reply