Reset Windows Update in Windows 10  

Page 1 of 50 12311 ... LastLast
    Reset Windows Update in Windows 10

    Reset Windows Update in Windows 10

    How to Reset Windows Update in Windows 10
    Published by Category: Windows Update & Activation
    29 Jul 2022
    Designer Media Ltd

    How to Reset Windows Update in Windows 10


    Windows Update keeps Windows 10 updated by downloading and installing the latest updates, drivers, and hotfixes released by Microsoft.

    Sometimes you may have an issue with Windows Update such as not being able to download or install updates, error messages, not being able to search for new updates, etc. These kind of issues can occur when the Windows Update database or components are corrupted, one or more services related to Windows Update are not running, etc.

    Resetting the Windows Update components can usually solve these types of issues.

    See also:

    This tutorial will show you how to completely reset Windows Update components and policies to default in Windows 10.

    You must be signed in as an administrator to reset Windows Update.

    This will not clear the Windows Update history.


    For a Windows 11 version of this tutorial, see:

    Reset Windows Update in Windows 11




    Here's How:

    1 Click/tap on the Download button below to download the .bat file below.

    Reset_Reregister_Windows_Update_Components.bat

    Download

    The downloadable .bat file below contains these commands that will reset Windows Update.


    Code:
    @echo off
    
    :: Created by: Shawn Brink
    :: Created on: October 1, 2015
    :: Updated on: March 8, 2021
    :: Tutorial: https://www.tenforums.com/tutorials/24742-reset-windows-update-windows-10-a.html
    
    
    :: Prompt to Run as administrator
    Set "Variable=0" & if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
    fsutil dirty query %systemdrive%  >nul 2>&1 && goto :(Privileges_got)
    If "%1"=="%Variable%" (echo. &echo. Please right-click on the file and select &echo. "Run as administrator". &echo. Press any key to exit. &pause>nul 2>&1& exit)
    cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%Variable%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs" & exit
    :(Privileges_got)
    
    :: Checking and Stopping the Windows Update services
    set b=0
    
    :bits
    set /a b=%b%+1
    if %b% equ 3 (
       goto end1
    ) 
    net stop bits
    echo Checking the bits service status.
    sc query bits | findstr /I /C:"STOPPED" 
    if not %errorlevel%==0 ( 
        goto bits 
    ) 
    goto loop2
    
    :end1
    cls
    echo.
    echo Cannot reset Windows Update since "Background Intelligent Transfer Service" (bits) service failed to stop. Please restart the computer, and try again.
    echo.
    pause
    goto Start
    
    
    :loop2
    set w=0
    
    :wuauserv
    set /a w=%w%+1
    if %w% equ 3 (
       goto end2
    ) 
    net stop wuauserv
    echo Checking the wuauserv service status.
    sc query wuauserv | findstr /I /C:"STOPPED" 
    if not %errorlevel%==0 ( 
        goto wuauserv 
    ) 
    goto loop3
    
    :end2
    cls
    echo.
    echo Cannot reset Windows Update since "Windows Update" (wuauserv) service failed to stop. Please restart the computer, and try again.
    echo.
    pause
    goto Start
    
    
    
    :loop3
    set app=0
    
    :appidsvc
    set /a app=%app%+1
    if %app% equ 3 (
       goto end3
    ) 
    net stop appidsvc
    echo Checking the appidsvc service status.
    sc query appidsvc | findstr /I /C:"STOPPED" 
    if not %errorlevel%==0 ( 
        goto appidsvc 
    ) 
    goto loop4
    
    :end3
    cls
    echo.
    echo Cannot reset Windows Update since "Application Identity" (appidsvc) service failed to stop. Please restart the computer, and try again.
    echo.
    pause
    goto Start
    
    
    :loop4
    set c=0
    
    :cryptsvc
    set /a c=%c%+1
    if %c% equ 3 (
       goto end4
    ) 
    net stop cryptsvc
    echo Checking the cryptsvc service status.
    sc query cryptsvc | findstr /I /C:"STOPPED" 
    if not %errorlevel%==0 ( 
        goto cryptsvc 
    ) 
    goto Reset
    
    :end4
    cls
    echo.
    echo Cannot reset Windows Update since "Cryptographic Services" (cryptsvc) service failed to stop. Please restart the computer, and try again.
    echo.
    pause
    goto Start
    
    
    :Reset
    Ipconfig /flushdns
    del /s /q /f "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" 
    del /s /q /f "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat"
    del /s /q /f "%SYSTEMROOT%\Logs\WindowsUpdate\*"
    
    
    if exist "%SYSTEMROOT%\winsxs\pending.xml.bak" del /s /q /f "%SYSTEMROOT%\winsxs\pending.xml.bak" 
    if exist "%SYSTEMROOT%\winsxs\pending.xml" ( 
        takeown /f "%SYSTEMROOT%\winsxs\pending.xml" 
        attrib -r -s -h /s /d "%SYSTEMROOT%\winsxs\pending.xml" 
        ren "%SYSTEMROOT%\winsxs\pending.xml" pending.xml.bak 
    ) 
      
    if exist "%SYSTEMROOT%\SoftwareDistribution.bak" rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution.bak"
    if exist "%SYSTEMROOT%\SoftwareDistribution" ( 
        attrib -r -s -h /s /d "%SYSTEMROOT%\SoftwareDistribution" 
        ren "%SYSTEMROOT%\SoftwareDistribution" SoftwareDistribution.bak 
    ) 
     
    if exist "%SYSTEMROOT%\system32\Catroot2.bak" rmdir /s /q "%SYSTEMROOT%\system32\Catroot2.bak" 
    if exist "%SYSTEMROOT%\system32\Catroot2" ( 
        attrib -r -s -h /s /d "%SYSTEMROOT%\system32\Catroot2" 
        ren "%SYSTEMROOT%\system32\Catroot2" Catroot2.bak 
    ) 
      
    
    :: Reset Windows Update policies
    reg delete "HKCU\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
    reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate" /f
    reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
    reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate" /f
    gpupdate /force
    
    
    :: Reset the BITS service and the Windows Update service to the default security descriptor
    sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
    
    sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
    
    :: Reregister the BITS files and the Windows Update files
    cd /d %windir%\system32
    regsvr32.exe /s atl.dll 
    regsvr32.exe /s urlmon.dll 
    regsvr32.exe /s mshtml.dll 
    regsvr32.exe /s shdocvw.dll 
    regsvr32.exe /s browseui.dll 
    regsvr32.exe /s jscript.dll 
    regsvr32.exe /s vbscript.dll 
    regsvr32.exe /s scrrun.dll 
    regsvr32.exe /s msxml.dll 
    regsvr32.exe /s msxml3.dll 
    regsvr32.exe /s msxml6.dll 
    regsvr32.exe /s actxprxy.dll 
    regsvr32.exe /s softpub.dll 
    regsvr32.exe /s wintrust.dll 
    regsvr32.exe /s dssenh.dll 
    regsvr32.exe /s rsaenh.dll 
    regsvr32.exe /s gpkcsp.dll 
    regsvr32.exe /s sccbase.dll 
    regsvr32.exe /s slbcsp.dll 
    regsvr32.exe /s cryptdlg.dll 
    regsvr32.exe /s oleaut32.dll 
    regsvr32.exe /s ole32.dll 
    regsvr32.exe /s shell32.dll 
    regsvr32.exe /s initpki.dll 
    regsvr32.exe /s wuapi.dll 
    regsvr32.exe /s wuaueng.dll 
    regsvr32.exe /s wuaueng1.dll 
    regsvr32.exe /s wucltui.dll 
    regsvr32.exe /s wups.dll 
    regsvr32.exe /s wups2.dll 
    regsvr32.exe /s wuweb.dll 
    regsvr32.exe /s qmgr.dll 
    regsvr32.exe /s qmgrprxy.dll 
    regsvr32.exe /s wucltux.dll 
    regsvr32.exe /s muweb.dll 
    regsvr32.exe /s wuwebv.dll
    regsvr32.exe /s wudriver.dll
    netsh winsock reset
    netsh winsock reset proxy
    
    :: Set the startup type as automatic
    sc config wuauserv start= auto
    sc config bits start= auto 
    sc config DcomLaunch start= auto 
    
    :Start
    net start bits
    net start wuauserv
    net start appidsvc
    net start cryptsvc
    
    :: Restart computer
    cls
    echo It is required to restart the computer to finish resetting Windows Update.
    echo.
    echo Please save and close anything open now, before the computer is restarted.
    echo.
    pause
    echo.
    echo.
    echo.
    echo *** Restart computer now. ***
    echo.
    pause
    shutdown /r /f /t 0

    2 Save the .bat file to your desktop.

    3 Unblock the .bat file.

    4 Run the .bat file.

    5 If prompted by UAC, click/tap on Yes to approve run as administrator.

    6 When resetting Windows Update has finished you will be prompted to Please save and close anything open now, before the computer is restarted., and press any key to continue when ready. (see screenshot below)

    If a service fails to stop after 3 attempts, the .bat file will automatically end with a "Failed to reset Windows Update" message and prompt to press a key to continue.

    When a key is pressed, the .bat file will then restart any service it had stopped before closing the command prompt.


    7 You will now be prompted to press any key to Restart computer now.

    This will immediately restart the computer.

    It is important to restart the computer immediately after running the .bat file to apply without opening anything else.

    Reset Windows Update in Windows 10-restart_computer.png


    That's it,
    Shawn






  1. Posts : 51
    Win 10 Pro x64
       #1

    Thanks a lot, Brink, for this one ! :)
    Very useful as, due to the new layout in Win 10, the overview of the history becomes quickly unbearable. This way, we can clean it up from time to time ...
      My Computer


  2. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #2

    I'm glad it could help throkr. :)
      My Computers


  3. Posts : 364
    Windows 10
       #3

    Shawn, does the script work for windows 7 or Windows 8.X
    I am concerned with the DLL's which might not be present in windows 7 or 8.
      My Computer


  4. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #4

    Sumitdhiman said:
    Shawn, does the script work for windows 7 or Windows 8.X
    I am concerned with the DLL's which might not be present in windows 7 or 8.
    Hello Sumitdhiman, :)

    It would be recommended to use the one below for Windows 7/8 instead.

    Windows Update - Reset - Windows 7 Help Forums
      My Computers


  5. Posts : 364
    Windows 10
       #5

    Brink said:
    Hello Sumitdhiman, :)

    It would be recommended to use the one below for Windows 7/8 instead.

    Windows Update - Reset - Windows 7 Help Forums
    You have the solution for everything!Keep up the good work and Thanks :)
      My Computer


  6. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #6

    You're most welcome. :)
      My Computers


  7. Posts : 19
    Windows 10 Pro 64bit
       #7

    Bat File Operation Time Frame?


    Brink,

    I followed steps per instructions but file is still running after 15 minutes. Should it take this long? It appears to be reaching a certain point then restarting.

    My updates were working correctly until today.
      My Computer


  8. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #8

    Hello Archquark, :)

    No it should not take that long. It usually only takes a few seconds. It sounds like it's still trying to kill one of the services. Most likely the wuauserv service. The .bat has built in checks to make sure the necessary services are stopped before continuing. If they are not, it will keep trying.

    If you like, try manually stopping the service, and run the .bat again.

    If you are unable to stop the service, then restart the computer, and try running the .bat again.
      My Computers


  9. Posts : 19
    Windows 10 Pro 64bit
       #9

    Unable to stop Windows Update Service


    Brink,

    I went to services and found that Windows Update was shown as stopping and startup type was selected manual. I rebooted my computer but on checking saw that status and startup type has not changed. Any other suggestions would be appreciated. Option to stop service is grayed out.

    Reset Windows Update in Windows 10-screenshot-2-.png
      My Computer


 

Tutorial Categories

Reset Windows Update in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:06.
Find Us




Windows 10 Forums