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 -Sourcewim: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:
- Standard Core (with optional GUI features removed)
- Standard (all features except .NET 3.5. present)
- Datacenter Core (optional GUI features removed)
- Datacenter (all features except .NET 3.5. present)
You can also use the path to a WinSxS folder as a -Source. If you mount theinstall.wimfile 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-WindowsFeatureuses 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: <link_coming_soon>
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.