Windows: Install a feature which is in State “removed”

Hi,

if a windows feature is in Install State removed, in this example the .NET Framework on Server 2012 R2.

PS C:\> Get-WindowsFeature *net*

Display Name                          Name                       Install State
------------                          ----                       -------------
.....
            [ ] ASP.NET 3.5           Web-Asp-Net                    Available
            [ ] ASP.NET 4.5           Web-Asp-Net45                  Available
[ ] .NET Framework 3.5 Features       NET-Framework-Features         Available
    [ ] .NET Framework 3.5 (inc....)  NET-Framework-Core             Removed
    [ ] HTTP Activation               NET-HTTP-Activation            Available
    [ ] Non-HTTP Activation           NET-Non-HTTP-Activ             Available
....

and if you try to install you’ll get an error message:

PS C:\> Install-WindowsFeature NET-Framework-Core

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 http://go.microsoft.com/fwlink/?LinkId=243077.
Error: 0x800f0906
At line:1 char:1
+ Install-WindowsFeature NET-Framework-Core
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + 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         {}

This occurs because the installation sources are not found respective the payload are removed from installation image install.wim.

The Solution is to install the missing features with Windows Update or if you have no internet connection to tell “Install-WindowsFeature” where the Windows sources are located.

Insert your Windows installation DVD or, if you are in a virtual environment, mount the dvd iso file. In this example the DVD is at drive Z:

PS C:\> dir z:
    Directory: Z:\
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        18.03.2014     13:16            boot
d-r--        18.03.2014     13:16            efi
d-r--        18.03.2014     13:16            sources
d-r--        18.03.2014     13:16            support
--r--        18.03.2014     13:16        128 autorun.inf
--r--        18.03.2014     13:16     398356 bootmgr
--r--        18.03.2014     13:16    1601880 bootmgr.efi
--r--        18.03.2014     13:16      77424 setup.exe

Install the missing feature by specifing the DVD \sources\sxs folder as source:

PS C:\> Install-WindowsFeature NET-Framework-Core -Source Z:\sources\sxs

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {.NET Framework 3.5 (includes .NET 2.0 and...

Thats it.

In Windows 8.x you have to use

PS C:\> Get-WindowsOptionalFeature  -Online
PS C:\> Enable-WindowsOptionalFeature -All -LimitAccess -online -FeatureName NetFx3 -Source D:\sources\sxs

instead of Get-WindowsFeature and Install-WindowsFeature.
If the error “The source file could not found. 0x800f081f” occurs, %SYSTEMROOT%\Logs\CBS\CBS.log contains CBS_E_SOURCE_MISSING errors: Uninstall all .NET releated Hotfixes:
KB2966826,KB2966828, KB2894856,KB2954879,KB2966826,KB2966828,KB2977765,KB2978041,KB2978126,KB2979576,KB3023222,KB3032663 and KB3037579. Remove also .NET 4.5 in “Turn Windows features on/off” and install .NET 3. From command line use

c:> wusa /uninstall /KB:2894856 /norestart
....

And Repair the cbs store and reinstall the fixes again

c:\> dism /online /cleanup-image /scanhealth
c:\> dism /Online /Cleanup-Image /RestoreHealth

Michael

Leave a Reply