Hello,
Welcome to the Microsoft Windows Community.
Good morning. This error is commonly associated with a connection failure to Microsoft servers. I am providing a script containing all the necessary commands to fix the error; simply open Notepad, copy and paste the text below, then click "File" > "Save as" (saving it to your desktop as "wufix"), and under "Save as type," select "All files." Run the script as an administrator; simply right-click on it and select "Run as administrator."
@echo off
setlocal EnableExtensions EnableDelayedExpansion
title Windows Update - Error 0x8024401C Fix
:: ============================================================
:: Windows 11 - Windows Update diagnostics and repair
:: Target error: 0x8024401C
:: Run this script as Administrator.
:: ============================================================
:: Check for administrator privileges
net session >nul 2>&1
if not "%errorlevel%"=="0" (
echo.
echo [ERROR] This script must be run as Administrator.
echo Right-click the file and select "Run as administrator".
echo.
pause
exit /b 1
)
set "LOG=%USERPROFILE%\Desktop\WindowsUpdate_0x8024401C_%COMPUTERNAME%.log"
echo ============================================================ > "%LOG%"
echo Windows Update - Diagnostics and Repair 0x8024401C >> "%LOG%"
echo Computer: %COMPUTERNAME% >> "%LOG%"
echo Date: %DATE% %TIME% >> "%LOG%"
echo ============================================================ >> "%LOG%"
echo.
echo ============================================================
echo Windows Update - Error 0x8024401C Fix
echo ============================================================
echo.
echo The log will be saved to:
echo %LOG%
echo.
call :run "Windows version information" "ver"
call :run "Current WinHTTP proxy configuration" "netsh winhttp show proxy"
echo.
echo [1/7] Checking Windows Update related policies...
echo.
if exist "%WINDIR%\System32\gpresult.exe" (
gpresult /h "%TEMP%\WindowsUpdate_GPResult.html" /f >> "%LOG%" 2>&1
echo Group Policy report saved to:
echo %TEMP%\WindowsUpdate_GPResult.html
)
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /s >> "%LOG%" 2>&1
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /s >> "%LOG%" 2>&1
echo.
echo [2/7] Resetting WinHTTP proxy...
netsh winhttp reset proxy >> "%LOG%" 2>&1
netsh winhttp show proxy >> "%LOG%" 2>&1
echo.
echo [3/7] Stopping Windows Update services...
call :run "Stopping Windows Update service" "net stop wuauserv /y"
call :run "Stopping BITS service" "net stop bits /y"
call :run "Stopping Cryptographic Services" "net stop cryptsvc /y"
echo.
echo [4/7] Backing up Windows Update caches...
if exist "%WINDIR%\SoftwareDistribution.old" (
echo Removing previous SoftwareDistribution.old backup...
rmdir /s /q "%WINDIR%\SoftwareDistribution.old" >> "%LOG%" 2>&1
)
if exist "%WINDIR%\System32\catroot2.old" (
echo Removing previous catroot2.old backup...
rmdir /s /q "%WINDIR%\System32\catroot2.old" >> "%LOG%" 2>&1
)
if exist "%WINDIR%\SoftwareDistribution" (
ren "%WINDIR%\SoftwareDistribution" SoftwareDistribution.old >> "%LOG%" 2>&1
)
if exist "%WINDIR%\System32\catroot2" (
ren "%WINDIR%\System32\catroot2" catroot2.old >> "%LOG%" 2>&1
)
echo.
echo [5/7] Restarting Windows Update services...
call :run "Starting Cryptographic Services" "net start cryptsvc"
call :run "Starting BITS service" "net start bits"
call :run "Starting Windows Update service" "net start wuauserv"
echo.
echo [6/7] Repairing Windows system components...
echo.
echo DISM /RestoreHealth may take several minutes.
echo.
DISM /Online /Cleanup-Image /RestoreHealth >> "%LOG%" 2>&1
set "DISM_RESULT=%ERRORLEVEL%"
echo DISM result: %DISM_RESULT%
echo.
echo Running System File Checker (SFC)...
echo.
sfc /scannow >> "%LOG%" 2>&1
set "SFC_RESULT=%ERRORLEVEL%"
echo SFC result: %SFC_RESULT%
echo.
echo [7/7] Collecting final Windows Update status...
echo.
sc query wuauserv >> "%LOG%" 2>&1
sc query bits >> "%LOG%" 2>&1
sc query cryptsvc >> "%LOG%" 2>&1
netsh winhttp show proxy >> "%LOG%" 2>&1
echo.
echo ============================================================
echo COMPLETED
echo ============================================================
echo.
echo DISM result: %DISM_RESULT%
echo SFC result: %SFC_RESULT%
echo.
echo The complete log has been saved to:
echo %LOG%
echo.
echo It is recommended to RESTART the computer before checking
echo Windows Update again.
echo.
choice /C YN /N /M "Do you want to restart now? [Y/N]: "
if errorlevel 2 goto END
if errorlevel 1 shutdown /r /t 10 /c "Restart after Windows Update repair"
:END
echo.
echo If you did not restart, press any key to close.
pause >nul
exit /b 0
:run
echo %~1...
echo. >> "%LOG%"
echo [%DATE% %TIME%] %~1 >> "%LOG%"
%~2 >> "%LOG%" 2>&1
set "RC=%ERRORLEVEL%"
echo Result: %RC%
echo Result: %RC% >> "%LOG%"
exit /b 0
Restart the computer and try the update again via Windows Update.