Если служба обновлений Windows работает не корректно, обновления не загружаются или не устанавливаются, то самый простой и эффективней способ решить проблему со службой Windows Update – восстановить ее исходные настройки. В этой статье мы покажем, как сбросить конфигурацию агента и службы обновлений Windows Update.
Содержание:
- Средство устранения неполадок Центра обновления Windows
- Сброс настроек Windows Update с помощью PowerShell
- Утилита Reset Windows Update Tool
- Восстановление исходных настроек Windows Update из командной строки
Обычно для отладки и дебага ошибок службы обновления Windows администратору необходимо проанализировать коды ошибок в файле журнала обновлений %windir%\WindowsUpdate.log (в Windows 10 и 11 получить файл WindowsUpdate.log можно таким способом). Количество возможных ошибок, с которыми может столкнуться администратор при анализе журнала обновлений исчисляется десятками (список всех ошибок Windows Update) и процесс их разрешения в основном нетривиальный. В некоторых случаях вместо детального анализа ошибок Windows Update гораздо быстрее и проще сначала произвести полный сброс настроек службы Windows Update. После сброса Windows Update вы можете выполнить сканирование и поиск обновлений.
Средство устранения неполадок Центра обновления Windows
Прежде чем перейти к сбросу конфигурации центра обновления Windows, настоятельно рекомендуем сначала попробовать более встроенное средство для автоматического исправления проблем в службе обновления Windows – средство устранения неполадок Центра обновления Windows (Windows Update Troubleshooter).
В Windows 10 и 11 Windows Update Troubleshooter уже встроен в современную панель Settings. Для предыдущих версий Windows его придется скачать вручную по ссылкам ниже:
- Windows 11 — Settings -> System -> Troubleshooter -> Other Troubleshooter -> Windows Update;
- Windows 10 – скачите wu10.diagcab по ссылке https://aka.ms/wudiag , либо запустите локальную версию инструмента: Пуск -> Параметры -> Обновления и безопасность -> Устранение неполадок -> Центр обновлений Windows (Start -> Settings -> Updates and Security -> Troubleshoot -> Additional Troubleshooters-> Windows Updates – resolve problems that prevent you from updating windows);
Для быстрого доступа к средствам исправления неполадок Windows можно использовать команду ms-settings:
ms-settings:troubleshoot
- Windows 7 и Windows 8.1 — WindowsUpdate.diagcab (https://aka.ms/diag_wu).
Дождитесь пока средство устранения неполадок Центра обновления Windows просканирует систему и попытается автоматически исправить все ошибки в службе Windows Update и связанных компонентах.
В моем случае была обнаружена и исправлена потенциальная ошибка в базе данных Центра обновления Windows. После этого перезагрузите компьютер и попробуйте выполнить поиск обновлений. Если обновления не загружаются или не устанавливаются, перейдите к следующему этапу.
Сброс настроек Windows Update с помощью PowerShell
Вы можете использовать PowerShell модуль PSWindowsUpdate для сброса настроек агента и службы Windows Update.
Установите модуль на свой компьютер из галереи скриптов PSGallery:
Install-Module -Name PSWindowsUpdate
Разрешите запуск PowerShell скриптов:
Set-ExecutionPolicy –ExecutionPolicy RemoteSigned -force
Выполните команду:
Reset-WUComponents –verbose
Команда Reset-WUComponents выполняет действия, по остановке служб, перерегистрации dll и очистке каталога C:\Windows\SoftwareDistribution, что и описанный чуть ниже bat скрипт.
VERBOSE: Background Intelligent Transfer Service (BITS) VERBOSE: Windows Update (wuauserv) VERBOSE: Application Identity (appidsvc) VERBOSE: Cryptographic Services (cryptsvc) Step 2: Delete the qmgr*.dat files Step 3: Backup software distribution folders VERBOSE: Renaming Software Distribution folder to C:\Windows\SoftwareDistribution.bak VERBOSE: Renaming CatRoot folder to C:\Windows\System32\Catroot2.bak Step 4: Remove old Windows Update logs VERBOSE: Deleting the C:\Windows\WindowsUpdate.log files. Step 5: Reset Windows Update services VERBOSE: Reset BITS service VERBOSE: Reset Windows Update service Step 6: Reregister dll's VERBOSE: regsvr32.exe / s atl.dll VERBOSE: regsvr32.exe / s urlmon.dll VERBOSE: regsvr32.exe / s mshtml.dll VERBOSE: regsvr32.exe / s shdocvw.dll VERBOSE: regsvr32.exe / s browseui.dll VERBOSE: regsvr32.exe / s jscript.dll VERBOSE: regsvr32.exe / s vbscript.dll VERBOSE: regsvr32.exe / s scrrun.dll VERBOSE: regsvr32.exe / s msxml.dll VERBOSE: regsvr32.exe / s msxml3.dll VERBOSE: regsvr32.exe / s msxml6.dll VERBOSE: regsvr32.exe / s actxprxy.dll VERBOSE: regsvr32.exe / s softpub.dll VERBOSE: regsvr32.exe / s wintrust.dll VERBOSE: regsvr32.exe / s dssenh.dll VERBOSE: regsvr32.exe / s rsaenh.dll VERBOSE: regsvr32.exe / s gpkcsp.dll VERBOSE: regsvr32.exe / s sccbase.dll VERBOSE: regsvr32.exe / s slbcsp.dll VERBOSE: regsvr32.exe / s cryptdlg.dll VERBOSE: regsvr32.exe / s oleaut32.dll VERBOSE: regsvr32.exe / s ole32.dll VERBOSE: regsvr32.exe / s shell32.dll VERBOSE: regsvr32.exe / s initpki.dll VERBOSE: regsvr32.exe / s wuapi.dll VERBOSE: regsvr32.exe / s wuaueng.dll VERBOSE: regsvr32.exe / s wuaueng1.dll VERBOSE: regsvr32.exe / s wucltui.dll VERBOSE: regsvr32.exe / s wups.dll VERBOSE: regsvr32.exe / s wups2.dll VERBOSE: regsvr32.exe / s wuweb.dll VERBOSE: regsvr32.exe / s qmgr.dll VERBOSE: regsvr32.exe / s qmgrprxy.dll VERBOSE: regsvr32.exe / s wucltux.dll VERBOSE: regsvr32.exe / s muweb.dll VERBOSE: regsvr32.exe / s wuwebv.dll Step 7: Reset WinSock VERBOSE: netsh winsock reset Step 8: Reset Proxy VERBOSE: netsh winhttp reset proxy Step 9: Start Windows Update services VERBOSE: Cryptographic Services (cryptsvc) VERBOSE: Application Identity (appidsvc) VERBOSE: Windows Update (wuauserv) VERBOSE: Background Intelligent Transfer Service (BITS) Step 10: Start Windows Update services VERBOSE: wuauclt /resetauthorization /detectnow
Запустите поиск обновлений из панели управления или выполните поиск доступных обновлений с помощью команды PowerShell:
Get-WUList
Утилита Reset Windows Update Tool
Есть еще одни полезный и простой инструмент для сброса настроек Windows Update — Reset Windows Update Tool. Раньше это скрипт был доступен на TechNet. Сейчас автор ведет репозиторий на GitHub (м https://github.com/ManuelGil/Script-Reset-Windows-Update-Tool ).
Для загрузки предлагается скомпилированный exe файл (C++) или обычный скрипт. Я предпочитаю использовать cmd скрипт.
- Скачайте ResetWUEng.zip и распакуйте на диск;
- Запустите файл ResetWUEng.cmd с правами администратора;
- Скрипт определит вашу версию ОС (в моем примере это Windows 10) и предложит 18 различных опций. Некоторые из них напрямую не относятся к сбросу настроек агента WU, но могут быть полезны для исправления различных неисправностей в Windows (проверка диска chkdsk, исправление ошибок в образе Windows с помощью DISM, сброс Winsock, очистка временных файлов и т.д.);
- Для сброса настроек Windows Update достаточно использовать опцию 2 — Resets the Windows Update Components (Сбросить компоненты службы обновления Windows). Нажмите 2 и Enter;
- Скрипт автоматически выполнит все действия, которые мы описали выше при выполнении ручного сброса агента обновлений Windows из командной строки.
Вы можете самостоятельно посмотреть, что делает скрипт, открыв в файл ResetWUEng.cmd в любом текстовом редакторе и изучив его содержимое. Например, опция 2 отправляет на процедуру components.
- После окончания работы скрипта Reset Windows Update Agent перезагрузите компьютер и проверьте работу службы обновлений.
Скрипт ResetWUEng.cmd универсальный и подходит для всех версий Windows: начиная с Windows XP и вплоть до Windows 11.
Восстановление исходных настроек Windows Update из командной строки
Процесс сброса настроек агента и службы обновления Windows состоит из нескольких этапов. Все описанные операции выполняются в командной строке и собраны в один bat файл (готовый скрипт можно скачать по ссылке ниже).
С помощью данного скрипта можно полностью сбросить конфигурацию службы Центра обновлений Windows, и очистить локальный кэш обновлений. Скрипт является универсальный и будет работать как в Windows 11/10/8.1/7, так и в Windows Server 2022/2019/2016/2012 R2/2008 R2. Скрипт помогает устранить большинство типовых ошибок в работе службы Windows Update, когда центр обновлений перестает загружать новые обновления или пишет, что при установке обновления возникают ошибки.
Убедитесь, что настройки Windows Update на вашем компьютере на задаются с помощью доменных или локальных политик. Для вывода результирующих настроек GPO можно воспользоваться утилитой gpresult или rsop.msc. Можно сбросить настройки локальной GPO по этой инструкции.
Итак, по порядку о том, что делает скрипт:
- Остановить службы Windows Update (Центр обновлений Windows), BITS и службы криптографии:
net stop bits
net stop wuauserv
net stop appidsvc
net stop cryptsvc
taskkill /im wuauclt.exe /f - Удалить служебных файлы qmgr*.dat в каталоге %ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\:
Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
- Переименовать служебные каталоги, в которых хранятся конфигурационные файлы и кэш обновлений (в случае необходимости их можно будет использовать как резервные копии). После перезапуска службы обновления, эти каталоги автоматически пересоздадутся:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak - Удаление старого журнала windowsupdate.log
del /f /s /q %windir%\windowsupdate.log
- Сброс разрешений на службы BITS и Windows Update (в случае, если права на службы были изменены)
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)
sc.exe sdset cryptsvc D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
sc.exe sdset trustedinstaller D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD) - Перерегистрация файлов системных динамических библиотек (dll), связанных со службами BITS и Windows Update:
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 - Сброс параметров Winsock
netsh winsock reset
- Сброс параметров системного прокси
netsh winhttp reset proxy
- Опционально. При использовании локального сервера WSUS, возможно дополнительно сбросить текущую привязку клиента к серверу WSUS путем удаления следующих параметров в ветке реестра HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate:
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v TargetGroup /f
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUServer /f
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUStatusServer /f - Запуск остановленных служб:
sc.exe config wuauserv start= auto
sc.exe config bits start= delayed-auto
sc.exe config cryptsvc start= auto
sc.exe config TrustedInstaller start= demand
sc.exe config DcomLaunch start= auto
net start bits
net start wuauserv
net start appidsvc
net start cryptsvc - Опционально. Для Windows 7 и 8.1 можно установить/переустановить последнюю версию агента Windows Update Agent (WUA). Скачать актуальную версию агента можно со страницы https://support.microsoft.com/en-us/kb/949104. Нужно скачать файл для вашей версии Windows
Актуальная версия агента WUA для Windows 7 SP1 x64 — 7.6. Принудительная переустановка агента WindowsUpdate выполняется следующими командами:
- для Windows 7 x86:
WindowsUpdateAgent-7.6-x86.exe /quiet /norestart /wuforce
- для Windows 7 x64:
WindowsUpdateAgent-7.6-x64.exe /quiet /norestart /wuforce
Совет. Текущую версию агента Windows Update Agent (WUA) в Windows 7 можно узнать в свойствах файла %windir%\system32\Wuaueng.dll. В нашем примере это 7.6.7600.256.
- для Windows 7 x86:
Осталось перезагрузить компьютер и запустить синхронизацию с сервером Windows Update /WSUS.
wuauclt /resetauthorization /detectnow
Затем зайдите в Центр обновления и проверьте, пропали ли проблемы при поиске, скачивании и установке обновлений.
Сам скрипт reset_win_update.bat можно скачать по ссылке reset_win_update.zip (пункты 9 и 11 в скрипте не выполняются, т.к. являются опциональными). Скрипт нужно скачать, распаковать и запустить с правами администратора.
После этого перезагрузите компьютер, затем зайдите в Центр обновлений и проверьте, пропали ли проблемы при поиске, скачивании и установке обновлений.
Если обновления Windows стали скачиваться и устанавливать корректно, можно удалить папки резервные копии папок:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak
Если ничего не помогло, попробуйте вручную скачать и установить последнее кумулятивное обновление для вашей версии Windows из каталога обновлений Microsoft Update Catalog.
:: Run the reset Windows Update components.
:: void components();
:: /*************************************************************************************/
:components
:: —— Stopping the Windows Update services ——
call :print Stopping the Windows Update services.
net stop bits
call :print Stopping the Windows Update services.
net stop wuauserv
call :print Stopping the Windows Update services.
net stop appidsvc
call :print Stopping the Windows Update services.
net stop cryptsvc
call :print Canceling the Windows Update process.
taskkill /im wuauclt.exe /f
:: —— Checking the services status ——
call :print Checking the services status.
sc query bits | findstr /I /C:«STOPPED«
if %errorlevel% NEQ 0 (
echo. Failed to stop the BITS service.
echo.
echo.Press any key to continue . . .
pause>nul
goto :eof
)
call :print Checking the services status.
sc query wuauserv | findstr /I /C:«STOPPED«
if %errorlevel% NEQ 0 (
echo. Failed to stop the Windows Update service.
echo.
echo.Press any key to continue . . .
pause>nul
goto :eof
)
call :print Checking the services status.
sc query appidsvc | findstr /I /C:«STOPPED«
if %errorlevel% NEQ 0 (
sc query appidsvc | findstr /I /C:«OpenService FAILED 1060«
if %errorlevel% NEQ 0 (
echo. Failed to stop the Application Identity service.
echo.
echo.Press any key to continue . . .
pause>nul
if %family% NEQ 6 goto :eof
)
)
call :print Checking the services status.
sc query cryptsvc | findstr /I /C:«STOPPED«
if %errorlevel% NEQ 0 (
echo. Failed to stop the Cryptographic Services service.
echo.
echo.Press any key to continue . . .
pause>nul
goto :eof
)
:: —— Delete the qmgr*.dat files ——
call :print Deleting the qmgr*.dat files.
del /s /q /f «%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat«
del /s /q /f «%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat«
:: —— Renaming the softare distribution folders backup copies ——
call :print Deleting the old software distribution backup copies.
cd /d %SYSTEMROOT%
if exist «%SYSTEMROOT%\winsxs\pending.xml.bak« (
del /s /q /f «%SYSTEMROOT%\winsxs\pending.xml.bak«
)
if exist «%SYSTEMROOT%\SoftwareDistribution.bak« (
rmdir /s /q «%SYSTEMROOT%\SoftwareDistribution.bak«
)
if exist «%SYSTEMROOT%\system32\Catroot2.bak« (
rmdir /s /q «%SYSTEMROOT%\system32\Catroot2.bak«
)
if exist «%SYSTEMROOT%\WindowsUpdate.log.bak« (
del /s /q /f «%SYSTEMROOT%\WindowsUpdate.log.bak«
)
call :print Renaming the software distribution folders.
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« (
attrib -r -s -h /s /d «%SYSTEMROOT%\SoftwareDistribution«
ren «%SYSTEMROOT%\SoftwareDistribution« SoftwareDistribution.bak
if exist «%SYSTEMROOT%\SoftwareDistribution« (
echo.
echo. Failed to rename the SoftwareDistribution folder.
echo.
echo.Press any key to continue . . .
pause>nul
goto :eof
)
)
if exist «%SYSTEMROOT%\system32\Catroot2« (
attrib -r -s -h /s /d «%SYSTEMROOT%\system32\Catroot2«
ren «%SYSTEMROOT%\system32\Catroot2« Catroot2.bak
)
if exist «%SYSTEMROOT%\WindowsUpdate.log« (
attrib -r -s -h /s /d «%SYSTEMROOT%\WindowsUpdate.log«
ren «%SYSTEMROOT%\WindowsUpdate.log« WindowsUpdate.log.bak
)
:: —— Reset the BITS service and the Windows Update service to the default security descriptor ——
call :print Reset the BITS service and the Windows Update service to the default security descriptor.
sc.exe sdset wuauserv D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
sc.exe sdset bits D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
sc.exe sdset cryptsvc D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
sc.exe sdset trustedinstaller D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
:: —— Reregister the BITS files and the Windows Update files ——
call :print Reregister the BITS files and the Windows Update files.
cd /d %SYSTEMROOT%\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
:: —— Resetting Winsock ——
call :print Resetting Winsock.
netsh winsock reset
:: —— Resetting WinHTTP Proxy ——
call :print Resetting WinHTTP Proxy.
if %family% EQU 5 (
proxycfg.exe -d
) else (
netsh winhttp reset proxy
)
:: —— Set the startup type as automatic ——
call :print Resetting the services as automatics.
sc.exe config wuauserv start= auto
sc.exe config bits start= delayed-auto
sc.exe config cryptsvc start= auto
sc.exe config TrustedInstaller start= demand
sc.exe config DcomLaunch start= auto
:: —— Starting the Windows Update services ——
call :print Starting the Windows Update services.
net start bits
call :print Starting the Windows Update services.
net start wuauserv
call :print Starting the Windows Update services.
net start appidsvc
call :print Starting the Windows Update services.
net start cryptsvc
call :print Starting the Windows Update services.
net start DcomLaunch
:: —— End process ——
call :print The operation completed successfully.
echo.Press any key to continue . . .
pause>nul
goto :eof
:: /*************************************************************************************/
If the Windows Update service is not working properly, updates are not downloaded or installed, then the easiest and most effective way to solve the problem with the Windows Update service is to restore its original settings. In this article, we’ll show you how to reset the Windows Update agent and service configuration.
Contents:
- Using Windows Update Troubleshooter to Fix Update Issues
- Resetting Windows Update Client Using PowerShell
- Using Reset Windows Update Tool
- Reset Windows Update Settings Using Command Prompt
Usually, to debug Windows Update errors, an administrator needs to analyze the error codes in the %windir%\WindowsUpdate.log file (in Windows 10 you can get the WindowsUpdate.log this way). The number of possible errors that an administrator may encounter when analyzing the Windows update log is dozens (a complete list of Windows Update errors) and the process of resolving them is non-trivial. To avoid undue efforts and waste no time, it’s much easier to completely reset the Windows Update service and agent to the default state.
Using Windows Update Troubleshooter to Fix Update Issues
Before proceeding to reset the configuration of Windows Update, we strongly recommend that you first try a simpler and quite effective tool to automatically fix problems in the Windows Update service using the built-in Windows Update Troubleshooter.
Windows Update Troubleshooter is already built into the modern Settings panel in Windows 10 and 11. For previous versions of Windows, you will have to download it manually:
- Windows 11 — Settings -> System -> Troubleshooter -> Other Troubleshooter -> Windows Update;
- Windows 10 – wu10.diagcab (https://aka.ms/wudiag ) or run the local version of the tool: Start -> Settings -> Updates and Security -> Troubleshoot -> Additional Troubleshooters-> Windows Updates (Resolve problems that prevent you from updating Windows);
For quick access the Windows troubleshooting tools, you can use the ms-settings URI command:
ms-settings:troubleshoot
- Windows 7 and Windows 8.1 — WindowsUpdate.diagcab (https://aka.ms/diag_wu).
Wait for the Windows Update Troubleshooter to scan your system and attempt to automatically fix any errors in the Windows Update and related components.
In my case, corruption in the Windows Update database was found and fixed. After that, it remains to restart the computer and try to scan for updates. If updates are not downloaded or installed, proceed to the next step.
Resetting Windows Update Client Using PowerShell
You can use the PSWindowsUpdate PowerShell module to reset the Windows Update agent and service.
Install the module on your computer from the PSGallery script gallery:
Install-Module -Name PSWindowsUpdate
Allow PowerShell scripts to be run:
Set-ExecutionPolicy –ExecutionPolicy RemoteSigned -force
Run the command:
Reset-WUComponents –verbose
The Reset-WUComponents command stops services, re-registers DLLs, and cleans up the C:\Windows\SoftwareDistribution folder, etc. The full log of actions is available.
VERBOSE: Background Intelligent Transfer Service (BITS) VERBOSE: Windows Update (wuauserv) VERBOSE: Application Identity (appidsvc) VERBOSE: Cryptographic Services (cryptsvc) Step 2: Delete the qmgr*.dat files Step 3: Backup software distribution folders VERBOSE: Renaming Software Distribution folder to C:\Windows\SoftwareDistribution.bak VERBOSE: Renaming CatRoot folder to C:\Windows\System32\Catroot2.bak Step 4: Remove old Windows Update logs VERBOSE: Deleting the C:\Windows\WindowsUpdate.log files. Step 5: Reset Windows Update services VERBOSE: Reset BITS service VERBOSE: Reset Windows Update service Step 6: Reregister dll's VERBOSE: regsvr32.exe / s atl.dll VERBOSE: regsvr32.exe / s urlmon.dll VERBOSE: regsvr32.exe / s mshtml.dll VERBOSE: regsvr32.exe / s shdocvw.dll VERBOSE: regsvr32.exe / s browseui.dll VERBOSE: regsvr32.exe / s jscript.dll VERBOSE: regsvr32.exe / s vbscript.dll VERBOSE: regsvr32.exe / s scrrun.dll VERBOSE: regsvr32.exe / s msxml.dll VERBOSE: regsvr32.exe / s msxml3.dll VERBOSE: regsvr32.exe / s msxml6.dll VERBOSE: regsvr32.exe / s actxprxy.dll VERBOSE: regsvr32.exe / s softpub.dll VERBOSE: regsvr32.exe / s wintrust.dll VERBOSE: regsvr32.exe / s dssenh.dll VERBOSE: regsvr32.exe / s rsaenh.dll VERBOSE: regsvr32.exe / s gpkcsp.dll VERBOSE: regsvr32.exe / s sccbase.dll VERBOSE: regsvr32.exe / s slbcsp.dll VERBOSE: regsvr32.exe / s cryptdlg.dll VERBOSE: regsvr32.exe / s oleaut32.dll VERBOSE: regsvr32.exe / s ole32.dll VERBOSE: regsvr32.exe / s shell32.dll VERBOSE: regsvr32.exe / s initpki.dll VERBOSE: regsvr32.exe / s wuapi.dll VERBOSE: regsvr32.exe / s wuaueng.dll VERBOSE: regsvr32.exe / s wuaueng1.dll VERBOSE: regsvr32.exe / s wucltui.dll VERBOSE: regsvr32.exe / s wups.dll VERBOSE: regsvr32.exe / s wups2.dll VERBOSE: regsvr32.exe / s wuweb.dll VERBOSE: regsvr32.exe / s qmgr.dll VERBOSE: regsvr32.exe / s qmgrprxy.dll VERBOSE: regsvr32.exe / s wucltux.dll VERBOSE: regsvr32.exe / s muweb.dll VERBOSE: regsvr32.exe / s wuwebv.dll Step 7: Reset WinSock VERBOSE: netsh winsock reset Step 8: Reset Proxy VERBOSE: netsh winhttp reset proxy Step 9: Start Windows Update services VERBOSE: Cryptographic Services (cryptsvc) VERBOSE: Application Identity (appidsvc) VERBOSE: Windows Update (wuauserv) VERBOSE: Background Intelligent Transfer Service (BITS) Step 10: Start Windows Update services VERBOSE: wuauclt /resetauthorization /detectnow
Search for updates in the Settings panel, or look for available Windows updates using PowerShell:
Get-WUList
Using Reset Windows Update Tool
Reset Windows Update Tool is another useful and simple tool for resetting Windows Update settings. This script used to be available on TechNet. The author currently maintains a repository on GitHub (https://github.com/ManuelGil/Script-Reset-Windows-Update-Tool). Let’s consider how to use it.
A compiled wureset.exe file (C++) or a regular batch script is offered for download. I prefer to use cmd script.
- Download the ResetWUEng.zip and extract it;
- Run the ResetWUEng.cmd as an administrator;
- The script will detect your OS version (in my example, it is Windows 10) and will offer 18 different options. Some of them are not directly related to the reset of WU agent settings, but can be useful for fixing various Windows issues (checking the disk with the
chkdsk
, repairing the Windows image with DISM, resetting Winsock, clearing temporary files, etc.); - To reset the Windows Update, it is usually sufficient to use option 2 – Resets the Windows Update Components. Press 2 and Enter;
- The script will automatically perform all the actions that we described below when performing a manual reset of the Windows Update Agent from the command line;
You can see the script performed actions by opening the ResetWUEng.cmd file in any text editor and examining its contents. For example, option 2 sends you to the :components function.
- After the completion of the Reset Windows Update Tool script, restart your computer and check for new updates.
The ResetWUEng.cmd script is universal and suitable for all Windows versions starting from Windows XP and up to Windows 11.
Reset Windows Update Settings Using Command Prompt
The process of resetting the Windows Update agent and service configuration consists of several steps. All the described operations are performed in the elevated command prompt. I added all commands in the single bat file.
Using this script, you can completely reset the configuration of Windows Update and clear the local update cache. The script is applicable for both workstations with Windows 11/10/8.1/7 and Windows Server 2022/2019/2016/2012 R2/2008 R2. This script helps to eliminate most typical Windows Update errors when Windows stops downloading new updates or errors appear during the update installation.
Make sure the Windows Update settings on your computer are not configured using domain or local group policies. You can use the gpresult
tool or rsop.msc
to display the resulting GPO settings. Or you can reset local GPO settings according to this guide.
Let’s consider what this script does step by step:
- Stop Windows Update, BITS, and cryptographic services:
net stop bits
net stop wuauserv
net stop appidsvc
net stop cryptsvc
taskkill /im wuauclt.exe /f
- Delete service files qmgr*.dat from the folder %ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\:
Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
- Rename system folders, in which configuration files and update cache are stored (if necessary, they can be used as backups). After restarting the update service (
wuauserv
), these directories will be automatically recreated:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak - Delete the old windowsupdate.log file:
del /f /s /q %windir%\windowsupdate.log
- Reset the permissions for BITS and Windows Update services (if service permissions have been changed):
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)
sc.exe sdset cryptsvc D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
sc.exe sdset trustedinstaller D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
- Re-register the files of system dynamic libraries (DLLs) related to BITS and Windows Update:
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
- Reset Winsock settings:
netsh winsock reset
- Reset system proxy settings:
netsh winhttp reset proxy
- Optional. When using a local WSUS server, you can also reset the current binding of a client to the WSUS server by deleting the following parameters in the registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate:
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v TargetGroup /f
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUServer /f
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUStatusServer /f - Start the previously stopped services:
sc.exe config wuauserv start= auto
sc.exe config bits start= delayed-auto
sc.exe config cryptsvc start= auto
sc.exe config TrustedInstaller start= demand
sc.exe config DcomLaunch start= auto
net start bits
net start wuauserv
net start appidsvc
net start cryptsvc -
Optional. In some cases, you’ll need to install/reinstall the version of Windows Update Agent (WUA). You can check the current Windows Update Agent Wuaueng.dll file version on your computer with PowerShell:
((Get-Item $Env:windir\system32\Wuaueng.dll).VersionInfo).ProductVersion
You can download the latest version of Windows Update agent here: https://support.microsoft.com/en-us/kb/949104.
Windows 8.1 –7.9.9600
Windows 8 –7.8.9200.16693
Windows 7 –7.6.7600.256
Use the following commands to force reinstall the Windows Update Agent: Windows 7 x86:
WindowsUpdateAgent-7.6-x86.exe /quiet /norestart /wuforce
Windows 7 x64:WindowsUpdateAgent-7.6-x64.exe /quiet /norestart /wuforce
Now you only have to restart your computer and run synchronization with Windows Update or WSUS.
wuauclt /resetauthorization /detectnow
Then go to the Windows Update and make sure that there are no errors while checking, downloading, and installing the updates.
The reset_windows_update_agent.bat script can be downloaded following this link reset_windows_update_agent.zip (options 9 and 11 are not included in the script since they are optional). Download the script, extract it, and run as an administrator.
If Windows updates are downloaded and installed correctly, you can remove the backup folders:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak
If all else fails, try to manually download and install the latest cumulative update for your Windows version from the Microsoft Update Catalog.
Download Windows Speedup Tool to fix errors and make PC run faster
While Windows Updates works smoothly most of the time, users may at times encounter issues while running Windows Update – like for instance – despite updates being available, the service might not detect and install them, updates might get not get installed properly, thus creating issues, the Windows Update service might be stuck at ‘updating’ and not update at all, and so on.
While one could try restarting the system, re-initiating the Windows Update service, rolling back previous updates if possible, troubleshooting Windows Update, run the Windows Update Troubleshooter, it may not always work. We have already seen how to manually reset Windows Update components to default. Today we will take a look at a Reset Windows Update Client Script that will completely reset the Windows Update client settings.
This script will completely reset the Windows Update client settings. It has been tested on Windows10 and Server 2012 R2. It will configure the services and registry keys related to Windows Update for default settings. It will also clean up files related to Windows Update, in addition to BITS related data. Because of some limitations of the cmdlets available in PowerShell, this script calls some legacy utilities (sc.exe, netsh.exe, wusa.exe, etc).
Take a backup of your data, restart your Windows system and log in as Administrator.
Download the PowerShell file from Technet/Github – link mentioned below. Right-click on the Reset-WindowsUpdate.psi file and select Run with PowerShell.
You will be asked to confirm. Once you confirm, the script will run and reset the Windows Update client.
The tool configures the registry keys, settings and services to default values. All updates are reset and once done, the system can be rebooted and the updates reinstalled.
Once the process is over, the PowerShell window will exit.
Thanks for these links Tynamite:
- Reset-WindowsUpdate.ps1 Powershell Script: github.com.
- Reset WSUS Client: github.com.
- Reset Windows Update Agent: github.com.
We had earlier also taken a look at another tool called Reset Windows Update Agent Tool that lets you reset the WU Agent to default values. This tool has been updated to be compatible with the latest Windows 10 version and has been downloaded by more than 100,000 users.
Related:
- Reset Windows Update Agent to default using the Reset Windows Update Components Tool
- Reset Windows Update Tool will restore settings & components to default automatically.
Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP (2016-2022). Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.
Reader Interactions
I reviewed Reset Windows Update Agent, a free script for Windows devices, back in 2015. The script provided Windows administrators with options to run select administrative tasks on the system the script was executed on.
The program was designed primarily to fix Windows Update related issues (hence the name) but administrators could run it to fix Winsock or delete temporary files in Windows as well.
The author of the script improved it since its initial release and the list of commands grew from nine in 2015 to 18 commands in 2018. The nine original options are all included and the new options increase the functionality of the script significantly.
A second look at Reset Windows Update Agent
You can download the Reset Windows Update Agent script from the Microsoft Technet Gallery website. The script is compatible with Windows XP and newer versions of Windows including Windows 10 and Windows 10 Insider Preview versions.
You need to unpack the archive first; it has a size of just 8 Kilobytes and an unpacked size of 38 Kilobytes. You may want to read the readme first before you start the script. Note that you need to run it with elevated privileges.
Just right-click on ResetWUEng.cmd and select «run as administrator» to do so. I suggest you go through the script before you run it on your system to make sure it does what it is supposed to do. Also, it is recommended that you create a backup of the system before you use it to perform any actions.
A disclaimer is displayed on start that you need to accept. Once that is out of the way all 18 options are listed.
Here is the list of options:
- Open System Properties.
- Reset the Windows Update Components.
- Delete temporary files in Windows.
- Open Internet Explorer options.
- Run Chkdsk on the partition Windows is installed on.
- Run the System File Checker tool.
- Scan the image for component store corruption.
- Check the image for corruption or other issues.
- Perform repair operations automatically.
- Clean up superseeded components.
- Delete incorrect Registry values.
- Repair / Reset Winsock.
- Force Group Policy Update.
- Search for Windows Updates.
- Explorer other local solutions.
- Explorer other online solutions.
- Download Diagnostic Tools.
- Restart the PC.
While it is clear automatically what some options do, e.g. Open System Properties, it may not be clear what others such as «Delete incorrect Registry values» do.
The only option to find out is to open the script in a plain text editor and check the relevant parts of it to see what it does.
The temporary file cleaning part for instance uses the two commands del /s /f /q «%TEMP%\*.*» and
del /s /f /q «%SYSTEMROOT%\Temp\*.*» to remove files from system temp folders.
Some operations run lots of commands. If you select to reset Windows Update components, a series of commands is executed that include stopping services, killing tasks, deleting files, registering files again and more.
Closing Words
Administrators can run all the commands the script includes manually as well if they know them. The script speeds up the process as you just have to press a button and hit return on the keyboard to run the commands.
Now You: Do you use scripts for Windows management? (via Deskmodder)
Summary
Author Rating
Software Name
Reset Windows Update Agent
Operating System
Windows
Software Category
Administration
Landing Page
Advertisement