Author Posts

January 10, 2018 at 10:52 am

Hi there,

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).

Cheers,

Dan

January 10, 2018 at 3:04 pm

There's nothing native on PowerShell per se that would achieve this; you'd want to look into the Deployment Toolkit, or use DISM or something to add the necessary binaries to your base OS image.

January 10, 2018 at 4:37 pm

Thanks for taking the time to reply Don – thought not. There's a nice '-Remove' parameter for trimming down the sxs cache, but not the opposite for pre-staging them...

Thanks anyway.