Using Features on Demand with Updated Systems and Patched Images

Using Features on Demand with Updated Systems and Patched Images

  • Comments 20
  • Likes

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 :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,

seehttp://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: http://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
  • 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 \\vhdstore\myimage.vhd

  • Brilliant! Thanks.

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

  • @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.

  • Hi Matthew,

    Can you lend your expertise here:

    social.microsoft.com/.../ac2f4dcb-a313-43ac-b0b6-3c1fd7e64fbb

    Thanks

  • Excuse me, I meant Ben.

  • @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?

  • Ben,

    OK, Thanks.

  • 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.

  • Hi,

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

    Also tried this one:

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

    Any idea what might be the correct syntax?

  • d:\sources\sxs only contains files that are not in the .wim. Per this blog posting, you should use -Source wim:d:\sources\install.wim:4    (or :2 if you are running Standard edition)

  • Awesome! Thank your for sharing your knowledge!

  • Nicely documented Ben!

  • I am unable to upgrade Core server to Minimal server with Install-WindowsFeature -Name Server-Gui-Mgmt-Infra -Vhd "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\SERVER-CORE.vhdx" -Source C:\mountdir\Windows\WinSxS. I have tried using -Source wim:d:\sources\install.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.

  • 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.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment