On a new laptop running Windows 10, 1809, I experienced an issue that caused the boot time to increase to over 5 minutes. After the boot process eventually finished, many devices were not working correctly.

For example, I found:

  • no Wi-Fi networks showing in the list before logging on
  • the fingerprint scanner is not working
  • after logging in, you can’t enter any text in the search bar or Windows app store apps

Device manager showed errors like this:

windows 10 slow boot with device manager errors

My first instinct was to update all drivers, firmware, BIOS etc. but that didn’t help. After some searching, I found some comments suggesting a possible solution.

The commenter had worked with Microsoft on a support case and the recommendation was to delete:

HKey_Users\S-1-5-19\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Mappings

Sure enough, after checking the Mappings registry key, I found thousands of entries there.

Here’s a batch file that can count the entries. This is based on a batch file from jftuga/stack overflow:

@echo off
setlocal EnableDelayedExpansion

set OUTPUT=reg_%RANDOM%.txt

:: check the local (working) PC
reg query "HKU\S-1-5-19\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Mappings" /s | findstr "REG_" > %OUTPUT%
set COUNT1=0
for /f %%a in (%OUTPUT%) do (
    ::echo %%a
    set /a COUNT1=!COUNT1! + 1
)
echo number of items PC0975: %COUNT1%

:: check the remote (slow) PC
@echo.
reg query "\\pc1003\HKU\S-1-5-19\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Mappings" /s | findstr "REG_" > %OUTPUT%
set COUNT2=0
for /f %%a in (%OUTPUT%) do (
    ::echo %%a
    set /a COUNT2=!COUNT2! + 1
)
echo number of items PC1003: %COUNT2%
del %OUTPUT% 2> nul

Running the batch file showed the difference between the machines:

“\\fileserver\work\docs\admin\systems\Windows 10\CountMappings.bat”

number of items PC0975: 0

number of items PC1003: 5778

The (temporary) fix

Created registry import file on PC1003 to delete and recreate the registry key:

c:\users\admin\Documents\PurgeMappings.reg:

Windows Registry Editor Version 5.00

[-HKEY_USERS\S-1-5-19\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Mappings]
[HKEY_USERS\S-1-5-19\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Mappings]

Created scheduled task to run as SYSTEM at computer startup and every 4 hours during the day

Set the action to:

reg import c:\users\admin\Documents\PurgeMappings.reg

I’ll be keeping an eye out for the official fix from Microsoft for this…

Update

Microsoft have released a fix for this issue in KB4501371 (for Windows 10, version 1809) and KB4501375 (for Windows 10, version 1903).

The fix involves setting a registry value to stop incremental growth of the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp

Set the DWORD value of CleanupLeakedContainerRegistrations to 1 to remove preexisting registrations or leave it at 0 (the default) to retain existing registrations.