Installing Windows Features Without Default Selections

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

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.