WindowsFeatureSet takes long time

Hi,

IIS installation through Roles and Features wizard takes about 4 minutes

The same amount of time it takes if I use WindowsFeature resource.

configuration Install-IIS{

    Import-DscResource -ModuleName PSDesiredStateConfiguration

    node localhost{
        
        WindowsFeature IIS{
            Ensure = 'Present'
            Name = 'Web-Server'
            IncludeAllSubFeature = $true
        }
    }

}

Install-IIS -OutputPath $PSScriptRoot
Start-DscConfiguration -Path $PSScriptRoot -ComputerName localhost -Wait -Verbose

but I don’t need all sub features…

So I decided to use WindowsFeatureSet

configuration Install-IIS{

    $features = 'Web-Default-Doc', 'Web-Dir-Browsing', 'Web-Http-Errors', 'Web-Static-Content',
                'Web-Http-Logging', 'Web-Request-Monitor',
                'Web-Stat-Compression', 'Web-Filtering', 'Web-Basic-Auth', 'Web-Windows-Auth',
                'Web-Net-Ext', 'Web-ASP', 'Web-Asp-Net', 'Web-ISAPI-Ext', 'Web-ISAPI-Filter', 'Web-WebSockets',
                'Web-Mgmt-Console', 'Web-Scripting-Tools',
                'Web-Net-Ext45', 'Web-Asp-Net45'

    Import-DscResource -ModuleName PSDesiredStateConfiguration

    node localhost{
        
        WindowsFeatureSet IIS{
            Ensure = "Present"
            Name = $features
        }

    }

}

Install-IIS -OutputPath $PSScriptRoot
Start-DscConfiguration -Path $PSScriptRoot -ComputerName localhost -Wait -Verbose

but it takes about 43 minutes. Why so long?

It’s just how the installer works. It has to enumerate a ton of stuff under the hood and it’s time consuming. Rather than doing it in one batch, it’s doing each one individually, which means it has to unpack the files, check all the dependencies, copy all the bits, and whatnot - for each one. It’s even slower on a VM if you’re not real careful about disk I/O throughput - installations are always a little hellish on a VM unless the storage layer is super performant.

I guess that’s the same as installing through Roles and Features wizard one subfeature at a time. So how can I speed it up without installing all unnecessary subfeatures?