Installing Windows Features Without Default Selections

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 1 year, 9 months ago.

  • Author
    Posts
  • #22881
    Profile photo of Matt McElreath
    Matt McElreath
    Participant

    I'm working on a configuration for a 2008 R2 server that uses the WindowsFeature resource to install a set of roles and features on the server. One of the things I have notices is that there are certain features that install all the sub-features underneath them by default. For example, I want to Install Web-Windows-Auth and Web-Filtering. Those both fall under Web-Security. If I use the following config to try to install Web-Security, Web-Windows-Auth and Web-Filtering, it ends up installing all the features under Web-Security. For Example, If I use the following config:

     
        WindowsFeature Web-Security {
    	    Name = "Web-Security"
    	    Ensure = "Present"
            IncludeAllSubFeature = $false
    	  }
        WindowsFeature Web-Windows-Auth {
    	    Name = "Web-Windows-Auth"
    	    Ensure = "Present"
            IncludeAllSubFeature = $false
    	  }
        WindowsFeature Web-Filtering {
    	    Name = "Web-Filtering"
    	    Ensure = "Present"
            IncludeAllSubFeature = $false
    	  }
    

    This doesn't just install Web-Security, Web-Windows-Auth and Web-Filtering. It installs all the features under Web-Security. I can get around this by taking Web-Security out of the config and just leaving the other two in there, but we want the config to document what is installed on these servers so that someone just needs to look at the config to know everything that is installed on the servers.

    Has anyone else run into this at all? I assume it has to do with the fact that when you manually go to add Web-Security to a server, it selects everything underneath it by default. I was just hoping there was a way to tell it not to use the defaults. I tried to set IncludeAllSubFeature to False but that didn't work.

    Thanks,
    Matt

  • #22960
    Profile photo of Don Jones
    Don Jones
    Keymaster

    That's a function of the underlying feature manager, unfortunately, and the current commands don't provide a workaround for that behavior. -InculdeAllSubFeature doesn't change the underlying default behavior. Under the hood, it's just doing whatever Install-WindowsFeature would natively do.

You must be logged in to reply to this topic.