Repair Windows Server 2016 Error 0x800f081f

Symptom:
PS C:\Windows\system32> Install-WindowsFeature DHCP -IncludeManagementTools
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. For more
information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f081f
At line:1 char:1
+ Install-WindowsFeature DHCP -IncludeManagementTools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (@{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature],
Exception
+ FullyQualifiedErrorId : DISMAPI_Error__Failed_To_Enable_Updates,Microsoft.Windows.ServerManager.Commands.AddWind
owsFeatureCommand

Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
False No Failed {}
Resolution:
# Clean up Windows Component Store, aka WinSXS (C:\Windows\winsxs)
DISM /Online /Cleanup-Image /StartComponentCleanup # fix WinSXS
# SFC /SCANNOW # fix corrupted system files
DISM /Online /Cleanup-Image /AnalyzeComponentStore # check WinSXS
# SFC /SCANNOW
# Restart-Computer # reboot to render changes effective
# Perform Windows Repair using Microsoft Windows Update sources (may not work):
# Run Restore Health after reboot
DISM /Online /Cleanup-Image /RestoreHealth

# PowerShell native command to restore health
Repair-WindowsImage -Online -RestoreHealth
# Perform Windows Repair using Windows ISO as the source (works better):

# Specify ISO Path to automatically generate the rest of the other variables
# Obtain ISO from Microsoft at https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2016/
# https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO
$isoPath="\\it-fs2\it$\Software\ISO's\SW_DVD9_Win_Server_STD_CORE_2016_64Bit_English_-4_DC_STD_MLF_X21-70526.iso"

# Autogen variables:
$isoMount=Mount-DiskImage $isoPath -PassThru
$driveLetter=($isoMount | get-volume).DriveLetter
$wimPath="$driveLetter`:\sources\install.wim:1"
$logPath="C:\Temp\dism-repair-windows.log"

# Restore Windows Health using provided ISO:
dism /online /cleanup-image /restorehealth /source:WIM:$wimPath /limitaccess # non-native PowerShell command
# Repair-WindowsImage -Online -RestoreHealth -Source $wimPath -LimitAccess -LogPath $logPath


# Dismount ISO when done
Dismount-DiskImage -ImagePath $isoPath
Sample Output:
# Failure scenario

PS C:\Windows\system32> dism /online /cleanup-image /restorehealth

Deployment Image Servicing and Management tool
Version: 10.0.14393.3085

Image Version: 10.0.14393.3085

[==========================100.0%==========================]
Error: 0x800f081f

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. For more informat
ion on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.

The DISM log file can be found at C:\Windows\Logs\DISM\dism.log
# Success scenario

PS C:\Windows\system32> DISM /Online /Cleanup-Image /StartComponentCleanup

Deployment Image Servicing and Management tool
Version: 10.0.14393.3085

Image Version: 10.0.14393.3085

[===== 10.0% ]

PS C:\Windows\system32> dism /online /cleanup-image /restorehealth

Deployment Image Servicing and Management tool
Version: 10.0.14393.3085

Image Version: 10.0.14393.3085

[==========================100.0%==========================]Done...

Leave a Reply

Your email address will not be published. Required fields are marked *