Windows Server 2012 R2 Features on Demand (Objective 1.1)

Features on Demand is a feature in Windows Server 2012 R2 that allow admins to specific where the binaries/setup files for additional “Roles and Features” are installed from.In a traditional Windows Server install all the binaries/setup files often referd to as the “payload” are stored in the C:\Windows\WinSXS folder also known as the Side By Side folder. This allows for any of the Windows Server Roles or Features to be install using local files however as this folder is located on every single server install it can potentially add up to a lot of “wasted” disk space.
Features On Demand allows you to remove the setup files for currently uninstalled Roles or Features to free up disk space. If a new role or feature needs to be installed after this the setup files can either be downloaded through Windows Update, from the relevent installation media or a network share.
By remove the payload for unused roles you can potentially save between 1 – 5 GB of disk space per server.
To remove the payload for currently unused Roles and Features run the following Powershell command:
Get-WindowsFeature | Where InstallState -Eq Available | Uninstall-WindowsFeature -Remove
This command can be broken down into three parts, the first part “Get-WindowsFeature” simply finds all features currently available to the server.
This is then piped into the “Where InstallState -Eq Available” part which filters for the uninstalled roles which still have payload files in the SXS folder.
The finally part “Uninstall-WindowsFeature -Remove” then reomves the files from the SXS folder.
Now that the installation payload files have been removed if you try install a new role or feature the installation files will be downloaded through Windows Update by default however you can specify a local resource if you wish.
One way to accomplish this is in Server Manager when you install a new role you get the chance to “Specify an alternate source path” during the install wizard.
Features on Demand - Specify alternate source pathYou can also Powershell to specify the source directory:
Install-WindowsFeature -Name Web-Server -Source \\ServerName\ShareName
And finally you can set the location in Group Policy:
Computer Configuration\Administrative Templates\System\Specify settings for optional component installation and component repair
Features on Demand - SXS GPO