共用方式為


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.

[PowerShell]
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 :4for 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,

seehttps://go.microsoft.com/fwlink/?LinkId=243077. 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: https://blogs.technet.com/b/joscon/archive/2012/11/14/how-to-update-local-source-media-to-add-roles-and-features.aspx

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

  • Anonymous
    January 01, 2003
    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)

  • Anonymous
    January 01, 2003
    @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.

  • Anonymous
    January 01, 2003
    @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.

  • Anonymous
    January 01, 2003
    I believe those finding this article useful will find the comments useful on the other blog post mentioned in this posting:   blogs.technet.com/.../3532554.aspx The comments started covering specific issues with maintaining an updated source install.wim file.

  • Anonymous
    January 01, 2003
    Previous comment is mine, just subscribed to be alerted for update

  • Anonymous
    January 01, 2003
    Nicely documented Ben!

  • Anonymous
    January 01, 2003
    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.

  • Anonymous
    January 01, 2003
    @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?

  • Anonymous
    January 01, 2003
    Dennis - did they manage to solve for you ?

  • Anonymous
    November 07, 2012
    The comment has been removed

  • Anonymous
    December 11, 2012
    Brilliant! Thanks.

  • Anonymous
    December 11, 2012
    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?

  • Anonymous
    December 12, 2012
    Hi Matthew, Can you lend your expertise here: social.microsoft.com/.../ac2f4dcb-a313-43ac-b0b6-3c1fd7e64fbb Thanks

  • Anonymous
    December 12, 2012
    Excuse me, I meant Ben.

  • Anonymous
    December 12, 2012
    Ben, OK, Thanks.

  • Anonymous
    December 12, 2012
    Hi, 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?

  • Anonymous
    December 12, 2012
    Awesome! Thank your for sharing your knowledge!

  • Anonymous
    May 04, 2013
    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.

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

  • Anonymous
    June 08, 2014
    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 http://support.microsoft.com/kb/2913316, don't know if the eval version has limited connectivity to windows update?

    Reading http://www.bhargavs.com/index.php/2013/03/13/error-0x800f0906-adding-gui-features-on-windows-server-2012-core/ gave me the impression this doesn't work from core and windows update?

    http://p0w3rsh3ll.wordpress.com/2012/10/10/switch-from-windows-2012-core-to-gui-mode-hands-on/ 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?

  • Anonymous
    June 30, 2014
    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.

  • Anonymous
    August 18, 2014
    Hi,

    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
    Regards,
    TECH

  • Anonymous
    October 02, 2014
    The comment has been removed

  • Anonymous
    December 01, 2014
    The comment has been removed

  • Anonymous
    May 14, 2015
    The comment has been removed

  • Anonymous
    September 27, 2015
    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?

  • Anonymous
    October 26, 2015
    How do I know when I log on to Windows Server 2012 core what the "machine account credentials" being used? Thx

  • Anonymous
    April 12, 2016
    Thanks for sharing such a article.
    http://indguru.com/