Using Features on Demand with Updated Systems and Patched Images

As we’ve discussed in the past, Features on Demand makes it easy to reduce the footprint of your Windows Servers by removing optional components you don’t need from your server’s local disk. When you install Server Core (the default installation option for Windows Server 2012), the files needed for the Server with a GUI functionality are removed in this way. We call features in this state “Disabled with Payload Removed,” or “Removed” for short.

If you later want to reinstall one of these features, Windows needs to use a remote installation source because, of course, the files aren’t available (“staged”) on the local disk.By default, we use Windows Update as an installation source. However, not all servers have connectivity or access to Windows Update. If you don’t have connectivity to Windows Update, you need to supply an installation source, e.g.

Install-WindowsFeature Server-Gui-Shell -Source wim:d:\sources\install.wim:4

Note: WSUS is not supported as an installation source.

Let’s see how this breaks down:

First, the -Source flag tells Windows to use a specified source. You can specify a directory to a winsxs folder e.g. on a mapped network drive, mounted WIM or VHD, or local disk. You can also specify the path to a Windows Image (WIM) file directly, by using the wim: prefix and specifying the image index immediately after the filename, in this case :4 for Serverdatacenter. (If you are running Standard edition, :2 will give you the full Standard image).For completeness, the default image indices are as follows:

(e.g. dism.exe /get-wiminfo /wimfile:d:\sources\install.wim )


Index : 1

Name : Windows Server 2012 SERVERSTANDARDCORE

Description : Windows Server 2012 SERVERSTANDARDCORE

Size : 7,195,580,708 bytes


Index : 2

Name : Windows Server 2012 SERVERSTANDARD

Description : Windows Server 2012 SERVERSTANDARD

Size : 11,999,848,937 bytes


Index : 3

Name : Windows Server 2012 SERVERDATACENTERCORE

Description : Windows Server 2012 SERVERDATACENTERCORE

Size : 7,176,243,455 bytes


Index : 4

Name : Windows Server 2012 SERVERDATACENTER

Description : Windows Server 2012 SERVERDATACENTER

Size : 11,995,224,677 bytes


These correspond to:

  1.        Standard Core (with optional GUI features removed)
  2.        Standard (all features except .NET 3.5. present)
  3.        Datacenter Core (optional GUI features removed)
  4.        Datacenter (all features except .NET 3.5. present)

You can also use the path to a WinSxS folder as a -Source. If you mount the install.wim file from the Windows Setup media, you’ll find the WinSxS folder as a sub-folder of the Windows folder.

If you are using a source that is located on a network share, you might see an error message that resembles the following:

Install-WindowsFeature Server-Gui-Shell -Source:wim:z:\install.wim:2

Install-WindowsFeature : The request to add or remove features on the specified server failed.

Installation of one or more roles, role services, or features failed.

The source files could not be downloaded.

Use the "source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location,

see Error: 0x800f0906

At line:1 char:1

+ Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell -Source:wim:z:\ins ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (@{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature], Exception

    + FullyQualifiedErrorId : DISMAPI_Error__Cbs_Download_Failure,Microsoft.Windows.ServerManager.Commands.AddWindowsFeatureCommand


Success Restart Needed Exit Code      Feature Result

------- -------------- ---------      --------------

False   No             Failed         {}

Example: Installing Server-Gui-Shell (Server Graphical Shell) on a Windows Server 2012 Standard box.


That’s because Install-WindowsFeature uses the machine account credentials – not your local user account credentials – to access the installation source. If the installation source is located on a network share, ensure that the machine account has permissions to read from the network share.

If you were to install an optional feature immediately after installing Windows Server 2012, you would have the RTM version of the binaries both installed on your server and on your installation media source. That’s all well and good. However, let’s say you update your server using Windows Update and an old version of a feature is superseded. Later, you want to reinstall that updated feature but the binaries have been removed from your system. When Windows goes to look at your installation source, it won’t be able to find the files for the feature anymore because it is looking for the updated binaries. Therefore, you need to patch your installation source as well.

My colleague Joseph Conway has written a post about how to actually go about updating your Windows images (your installation sources) using patches from the Microsoft Update Catalog. Read more here:

It is important to note that when you update your installation source, you are adding additional versions to the component store. Old versions of components remain available for servers that need those versions. However, when you install a Windows feature using Install-WindowsFeature, Windows kicks off a Windows Update scan immediately after installing the feature. This ensures that (at least for servers with Windows Update enabled), accidentally installing an old version of a feature won’t compromise the security of the system.

Please let me know if you have any issues using the new Features on Demand functionality. We’d love to hear our customers’ feedback and I look forward to answering any questions that you may have.

Comments (28)

  1. d:sourcessxs only contains files that are not in the .wim. Per this blog posting, you should use -Source wim:d:sourcesinstall.wim:4    (or :2 if you are running Standard edition)

  2. @Boris, the error you are seeing makes me think that your image might not be patched in exactly the same way as your target server. Unfortunately this can be quite tricky when you are dealing with offline VHDs. My suggestion would be that you boot up the VHD and also another VM running Server with a GUI, run Windows Update to ensure that both servers are in the same patch state, and then capture the VM running Server Graphical Shell to a new WIM file, and use that as your installation source.

  3. @Miguel- yes!  There is no difference accessing the .wim file stored locally, on the network (as long as permissions are set properly), or on a DVD disc. Storing the .wim file on a disc may make it more difficult to update, though.

  4. JoeGasper says:

    I believe those finding this article useful will find the comments useful on the other blog post mentioned in this posting:…/3532554.aspx

    The comments started covering specific issues with maintaining an updated source install.wim file.

  5. StijnW says:

    Previous comment is mine, just subscribed to be alerted for update

  6. No problem. I've requested access to that forum. However, I do not know what the process is or how long it will take to get access, so if you can provide me with more details about the issue I can try to resolve it in the meantime.

  7. @Miguel- I'm not able to access that URL. Can you please reach out to your TAP or Partner contact and have them route your request to me?

  8. Anonymous says:

    Dennis – did they manage to solve for you ?

  9. Matthew Wetmore (MSFT) says:

    Using the machine credentials may seem like a pain, but it enables some useful functionality.

    Hyper-V accesses remote VHDs using the same credential.   Assuming you've already set your repository up for access by Hyper-V, you can then use the same setup to add/remove roles to the VHDs – including running the command from a third remote machine.

    The command line looks like:

    Add-WindowsFeature -computername hypervisor -vhd \vhdstoremyimage.vhd

  10. miguel says:

    Brilliant! Thanks.

  11. miguel says:

    So when installing features, you could either create the DISM source or use the -Source wim:d:sourcesinstall.wim:4 command to retrieve directly from a CD ROM? Any difference?

  12. miguel says:

    Excuse me, I meant Ben.

  13. miguel says:


    OK, Thanks.

  14. miguel says:


    Dism /online /enable-feature /featurename:ServerCore-FullServer /featurename:Server-Gui-Shell /featurename:Server-Gui-Mgmt gets /All /LimitAccess /Source:x:sourcessxs

    Also tried this one:

    Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart –Source:d:sourcessxs /LimitAccess

    Any idea what might be the correct syntax?

  15. miguel says:

    Awesome! Thank your for sharing your knowledge!

  16. Boris says:

    I am unable to upgrade Core server to Minimal server with Install-WindowsFeature -Name Server-Gui-Mgmt-Infra -Vhd "C:UsersPublicDocumentsHyper-VVirtual hard disksSERVER-CORE.vhdx" -Source C:mountdirWindowsWinSxS. I have tried using -Source wim:d:sourcesinstall.wim:2 also but I allways get error:

    Install-WindowsFeature : The request to add or remove features on the specified server failed.

    Installation of one or more roles, role services, or features failed.

    The source files could not be found.

    Use the "Source" option to specify the location of the files that are required to restore the feature.

  17. Server Guru says:

    Sooo, the long-standing question.  When is Microsoft going to add support for Features on Demand to WSUS?

  18. Stijn says:

    I’m "test driving"/ learning about W12r2 and downloaded the iso 9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9 (trial dvd from microsoft website)

    Installed 12r2 in core mode, have internet connection, set windows update settings to automatic and downloaded and installed all updates.

    I’d like to try to install features via windows update.

    When I try to install server-gui-mgmt-infra, I get the error (at 68% completion) that source files could not be downloaded with microsoft fwlink 243077 and error 0x800f0906.

    This is different from error message described here, don’t know if the eval version has limited connectivity to windows update?

    Reading gave me the impression this doesn’t work from core and windows update? gives the impression that you allways need to download
    or have your sources locally available.

    What’s the point of using windows update then? Or am I missing something?

  19. DaveHassen says:

    This feature is actually a nightmare. It’s taken a while to even track the problem I’ve been having re-adding a gui to the fact that the patch versions need to be the same. Now I need to work out which patches have been applied to my server core installation
    before then applying them to an image. I’m sure there are good reasons for this being built this way, but it’s the single most frustrating problem I’ve come across on Server 2012r2. I won’t be removing payload in the future.

  20. tech4 says:


    I encounter a similar issue when trying to install the .NET Framework 3.5 feature…
    As the feature binaries are not included in the DVD( I used the same one I installed the OS with) and as my virtual has no connection to the internet I am not able to install the feature.

    Do you have an idea of what I could try ?

    Had a case opened with Microsoft 3 months ago…

    Thanks in advance

  21. I just finished struggling with enabling a previously removed feature (WoW64) on a stripped down (everything removed except for Hyper-V and Powershell) 2012 R2 server with several months worth of updates installed. I’m sharing my story in case it helps

    The initial attempt failed, despite the server having unrestricted Windows Update connectivity. I then proceeded to build a patched installation source by creating a 2012 R2 RTM VM (full GUI installation), enabling .NET 3.5 (so that no features were left in
    the ‘Removed’ state), installing all updates, turning off the VM and capturing its VHD into a WIM file. However, Install-WindowsFeature still failed, despite specifying the -Source argument.

    Reading through the CBS log file (C:WindowsLogsCBSCBS.log), I noticed that error messages about missing files and download failures referenced only two files from KB2982791. That update caused problems on some machines and is no longer available for download.
    Unfortunately, my server had it installed, and even though the update had been superceded by later updates, apparently its files were still needed when enabling features.

    Uninstalling that update fixed the issue and allowed Install-WindowsFeature to execute successfully. (Tip: wusa /uninstall /kb:2982791 – fortunately no need to have the msu file, despite what the docs say.)

    Moral: expired updates might prevent Install-WindowsFeature from working, despite providing an up-to-date installation source.

  22. Dennis says:

    I am having big problems on a newly installed Windows 2012 R2 server. I installed the server, enabled some roles and features. Ran Windows update. Then next tried to install the Desktop Experience feature. But with no luck. I got the error about Source.
    I have the DVD in the server. I tried to install with PowerShell.
    Install-WindowsFeature Desktop-Experience -Source:wim:D:install.wim:2
    I got the same error as mention above.
    I tried mounting Wim.
    Install-WindowsFeature Desktop-Experience -Source:wim:C:WIMMOUNTinstall.wim:2
    I guess that my source is not updated with updates from Windows Update. But I just cant figure out how to update the source files.
    I have a case runing with Microsoft, and the technician is more blank than me.
    How can I update the source files? Is that the solution?
    Kind regards

  23. Dennis - did they manage to solve for you ? says:

    im facing same problem

  24. Jason says:

    For my case, the core server 2012 R2 has been there for sometime now. Looking at the updates, there are a lot. (around 135 updates). Is there anyway to update the install files automatically instead of downloading it one by one?

  25. GMK says:

    How do I know when I log on to Windows Server 2012 core what the "machine account credentials" being used? Thx

  26. central government jobs says:

    Thanks for sharing such a article.

Skip to main content