none
Enable-WindowsOptionalFeatures in Windows 10 RRS feed

  • Question

  • Hi all,

    I am trying to turn on a set of Windows features using this powershell code:

    $Features = Get-Content ".\Features.txt"
    
    foreach ($Feature in $Features)
        {
            Enable-WindowsOptionalFeature -Online -FeatureName $Feature -NoRestart -ErrorAction SilentlyContinue        
    
        }

    Features.txt contains:

     WCF-HTTP-Activation
    WCF-NonHTTP-Activation
    WCF-Services45
    WCF-HTTP-Activation45
    WCF-Pipe-Activation45
    WCF-TCP-Activation45
    WCF-TCP-PortSharing45
    IIS-ASPNET45
    IIS-IIS6ManagementCompatibility
    IIS-ManagementConsole
    IIS-ManagementScriptingTools
    IIS-WMICompatibility
    IIS-Metabase
    IIS-ManagementService
    IIS-NetFxExtensibility
    IIS-NetFxExtensibility45
    IIS-ASP
    IIS-ASPNET
    IIS-ASPNET45
    IIS-ISAPIExtensions
    IIS-ISAPIFilter
    IIS-ServerSideIncludes
    IIS-DefaultDocument
    IIS-DirectoryBrowsing
    IIS-DirectoryBrowsing
    IIS-HttpErrors
    IIS-HttpRedirect
    IIS-StaticContent
    IIS-HttpLogging
    IIS-RequestMonitor
    IIS-HttpTracing
    IIS-HttpCompressionStatic
    IIS-BasicAuthentication
    IIS-ClientCertificateMappingAuthentication
    IIS-RequestFiltering
    IIS-WindowsAuthentication
    WAS-NetFxEnvironment
    WAS-ProcessModel

    I am able to successfully enable all except:

    WCF-HTTP-Activation
    WCF-NonHTTP-Activation
    WCF-HTTP-Activation45
    WCF-Pipe-Activation45
    WCF-TCP-Activation45
    IIS-ASPNET45
    IIS-ManagementService
    IIS-NetFxExtensibility
    IIS-NetFxExtensibility45
    IIS-ASP
    IIS-ASPNET
    IIS-ASPNET45
    WAS-NetFxEnvironment
    WAS-ProcessModel

    any suggestions?

    • Moved by Bill_Stewart Thursday, January 25, 2018 10:36 PM This is not "fix/debug/rewrite my script for me" forum
    Monday, November 20, 2017 2:19 AM

All replies

  • No.  All features requested may not be available  Without error messages the question cannot be answered.

    \_(ツ)_/

    Monday, November 20, 2017 3:17 AM
  • I have updated the script to cater for the installation of dotNetframework 3.5

    $CommandLine = "DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:.\"
    Invoke-Expression -Command $CommandLine
    
    
    $Features = Get-Content ".\Features.txt"
    
    foreach ($Feature in $Features)
        {
            
            Enable-WindowsOptionalFeature -Online -FeatureName $Feature -NoRestart -ErrorAction SilentlyContinue               
    
        }
    
    

    the sample error I am getting is:

    WAS-NetFxEnvironment


    Enable-WindowsOptionalFeature : One or several parent features are disabled so current feature can not be enabled.

    At C:\temp\Enable-WindowsOptionalFeatures1\Enable-WindowsOptionalFeatures.ps1:16 char:9

    +         Enable-WindowsOptionalFeature -Online -FeatureName $Feature - ...

    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : NotSpecified: (:) [Enable-WindowsOptionalFeature], COMException

        + FullyQualifiedErrorId : Microsoft.Dism.Commands.EnableWindowsOptionalFeatureCommand

    Monday, November 20, 2017 4:45 AM
  • Enable-WindowsOptionalFeature -Online -FeatureName $Feature -NoRestart -All

    \_(ツ)_/

    Monday, November 20, 2017 10:26 AM