Add-WindowsFeature - Make Available but not Install

This topic contains 2 replies, has 2 voices, and was last updated by  DanT 1 week, 6 days ago.

  • Author
    Posts
  • #91181

    DanT
    Participant

    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

  • #91199

    Don Jones
    Keymaster

    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.

  • #91201

    DanT
    Participant

    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.

You must be logged in to reply to this topic.