“The source files could not be found” when installing a Server feature

The source files could not be found. Error 0x800f0906.

This infamous error, that may be returned when installing a Windows Server feature, indicates the inability of the installer to access the source files or the correct version of the source files. As per this blog, even specifying the installation media may not resolve the problem, as the installer may be expecting a different version of the binaries. Allowing updates from WSUS may work, but in my experience this isn’t usually the case.

There are several options for resolving this problem, e.g.:

Install-WindowsFeature AD-Domain-Services -Source Online
Install-WindowsFeature AD-Domain-Services -Source wim:"X:\sources\install.wim":2
Install-WindowsFeature AD-Domain-Services -Source "X:\sources\sxs\"

Obviously, adjust the drive letter to the appropriate letter of your mounted installation ISO.

One particularly troublesome feature is AD Domain Services, for which I have found that the only solution is to provide access to a copy of the SxS store of the same binary version, e.g. the SxS store on another similarly-patched server. Using Install-WindowsFeature accesses network shares using the server’s context, which generally won’t have access to an admin share on a DC, so the Enable-WindowsOptionalFeature cmdlet must be used, which uses the current user’s context:

Enable-WindowsOptionalFeature -Online -FeatureName DirectoryServices-DomainController -All -Source "\\DC01\C$\Windows\WinSxS\"

Remote administration of Server 2012 R2 Core

Windows Server 2012 R2 Core requires some configuration changes to the firewall and registry to enable remote administration. I’ve struggled to find a comprehensive list, so I’ll keep one here of the commands I use regularly.

General

Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
Enable-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI)"
Enable-NetFirewallRule -DisplayGroup "Remote Event Log Management"
Enable-NetFirewallRule -DisplayGroup "Remote Service Management"
Enable-NetFirewallRule -DisplayGroup "File and Printer Sharing"
Enable-NetFirewallRule -DisplayGroup "Remote Scheduled Tasks Management"
Enable-NetFirewallRule -DisplayGroup "Performance Logs and Alerts"
Enable-NetFirewallRule -DisplayGroup "Windows Remote Management"
Enable-NetFirewallRule -DisplayGroup "Windows Firewall Remote Management"
Enable-NetFirewallRule -DisplayGroup "Routing and Remote Access"

IIS

Install-WindowsFeature Web-Mgmt-Service
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WebManagement\Server" -Name "EnableRemoteManagement" -Value "1"
New-NetFirewallRule -Action Allow -Direction Inbound -DisplayName "IIS Management" -Service "WMSVC"
Set-Service "WMSVC" -StartupType Automatic
Start-Service "WMSVC"