I’ve got a requirement to build Windows Server 2012 images where .Net FW 3.5 is available to install (e.g for any applications that require it - e.g. SQL Server), but not installed on every server by default.
It appears that a vanilla OS build leaves the feature in a state of ‘Removed’.
I use Packer to build the image, so my current workaround is to install the feature from the mounted .iso:
Install-WindowsFeature –Name NET-Framework-Features –source $cdDrive:\sources\sxs -Confirm:$false
…and then immediately remove it:
Install-WindowsFeature –Name NET-Framework-Features -Confirm:$false
…as this then leaves the feature as “available” (and has obviously copied the requisite files to the local sxs folder…)
But this seems a bit clunky (and adds a couple of minutes to the build).