Features on Demand in Windows 8 and Windows Server 2012

This was written by a co-worker of mine, Jim Collins.

Features on Demand is a new feature in Windows 8 and Windows Server 2012 that will allow you to remove files associated with specific roles and features, typically referred to as payload files. The major benefit of this feature is to conserve disk space. Once removed, these binaries will need to be added back from a valid installation source before the feature can be used again. Unlike the stage and un-stage process used by the component store, Features on Demand removal results in a permanent removal of those binaries. Available sources include Windows 8/Windows Server 2012 WIM files, an expanded Windows 8/Windows Server 2012 DVD (flat), an available network location with Windows 8/Windows Server 2012 installation files and Windows Update.

Removing Roles/Features from a computer using Features on Demand

First let’s talk about removing Roles and Features from an installed Operating System. Features on Demand is exposed via the DISM command line interface as well as the new DISM and Server Manager Windows PowerShell cmdlets. Below are examples of the new DISM and Server Manager Windows PowerShell cmdlets.

clip_image001

DISM PowerShell Cmdlet

clip_image002

Server Manager PowerShell Cmdlet

It’s important to note that in Windows 8 features on demand is only exposed via DISM and DISM PowerShell cmdlets. This is important because DISM does not understand the parental dependencies. So DISM will only remove the packages you specify and will not remove any dependent packages, if they exist. For this reason it is highly recommended to only use the Server Manager PowerShell cmdlets to remove features in Windows Server 2012.

Below I will give an example of how you would remove the payload for the Windows Server Backup feature using all three methods:

DISM:

DISM.exe /Online /Disable-Feature /Featurename:WindowsServerBackup /Remove

To verify the payload has actually been removed you would run the following:

clip_image003

You can see from the above screenshot, that the State is Disabled with Payload Removed

DISM PowerShell Cmdlet:

Disable-WindowsOptionalFeature –Online –FeatureName WindowsServerBackup –Remove

To verify the payload has actually been removed you would run the following:

clip_image004

You can see from the above screenshot that the State is DisabledWithPayloadRemoved

Server Manager PowerShell Cmdlet:

Remove-WindowsFeature Windows-Server-Backup –Remove

To verify the payload has actually been removed you would run the following:

clip_image005

You can see from the above screenshot, that the Install State is Removed

To get a list of all Roles/Features that have been Removed you can run the following command

Get-windowsfeature | Where-Object {$_.InstallState -eq "Removed"}

clip_image006

Removing Roles/Features from an installation source

An administrator can also remove Roles and Features from an installation source so that they can reduce the size of their image as well as limit the Roles and Feature a specific group will have available to them. In this scenario, administrators must consider some factors to ensure the removal does not inversely effect the environment. First you will need to know what type of installation source will be used when adding roles or features back to the image. You will also need to take into account how much disk space will be needed for the addition of Roles and Features. Administrators will want to keep at least 10 GB of space free for potential component store growth.

Below are the steps to remove the Windows Server Backup feature from an installation source

1. Copy the installation WIM to a local directory (in this example C:\)

2. Create a mount directory to mount the WIM to (in this example C:\image)

3. Find the index of the image you will be editing:

DISM /get-imageinfo /imagefile:c:\install.wim

4. Mount the image to the folder created in step #2:

DISM /mount-image /imagefile:c:\install.wim /index:3 /mountdir:c:\image

5. Remove the Feature from the image:

DISM /image:c:\image /disable-feature /featurename:WindowServerBackup /remove

6. Verify the state of the feature is removed:

DISM /image:c:\image /get-featureinfo /featurename:WindowsServerBackup

7. Commit the changes to the WIM:

DISM /unmounts-image /mountdir:c:\image /commit

8. Prepare the image for deployment by adding it to a WDS or MDT deployment point.

--Joseph