Nero Atreides
Lt. Commander Pro
- Registriert
- Jan. 2004
- Beiträge
- 1.388
Moin,
Updated: continued on GitHub.
nach einem extrem nervigen Karfreitag gibt es nun eine zugegeben komplexe, aber funktionierende Lösung für das jüngste Windows Update Problem (Installationsfehler 0x80070306 bei KB5086672, KB5079473).
Zugegeben, am besten funktioniert das Inplace-Upgrade, das dauert ca. 20 Min und danach ist alles gefixt. ABER nachdem ich mich 9h lang durch alles gepflügt habe, was man so anstellen kann ohne ein Inplace-Upgrade machen zu müssen will ich Euch das nicht vorenthalten. Ich habe es in eine .BAT gepackt, das Skript findet ihr unten. Wenn ihr den Code in eine Datei mit der Endung .bat kopiert, dann habt ihr ein ausführbares Skript für Windows.
Verwendung auf eigene Gefahr - bei mir hat es funktioniert.
Allein den Software Distribution Ordner mit 750.000 Dateien (!) loszuwerden war eine Offenbarung
Have fun.
GitHub inkl. README und CHANGELOG.
Lässt sich dort besser pflegen.
Updated: continued on GitHub.
nach einem extrem nervigen Karfreitag gibt es nun eine zugegeben komplexe, aber funktionierende Lösung für das jüngste Windows Update Problem (Installationsfehler 0x80070306 bei KB5086672, KB5079473).
Zugegeben, am besten funktioniert das Inplace-Upgrade, das dauert ca. 20 Min und danach ist alles gefixt. ABER nachdem ich mich 9h lang durch alles gepflügt habe, was man so anstellen kann ohne ein Inplace-Upgrade machen zu müssen will ich Euch das nicht vorenthalten. Ich habe es in eine .BAT gepackt, das Skript findet ihr unten. Wenn ihr den Code in eine Datei mit der Endung .bat kopiert, dann habt ihr ein ausführbares Skript für Windows.
Verwendung auf eigene Gefahr - bei mir hat es funktioniert.
Allein den Software Distribution Ordner mit 750.000 Dateien (!) loszuwerden war eine Offenbarung
Have fun.
GitHub inkl. README und CHANGELOG.
Lässt sich dort besser pflegen.
Code:
@echo off
setlocal enabledelayedexpansion
title ULTIMATE WINDOWS UPDATE RECOVERY for WIN11 25H2 | Build 260404 by RoC-42 (GPL v3)
color 0b
:: --- ADMIN CHECK & AUTO-ELEVATION ---
net session >nul 2>&1
if %errorLevel% neq 0 (
echo [!] Requesting administrative privileges...
powershell -Command "Start-Process -FilePath '%~dpnx0' -Verb RunAs"
exit /b
)
:MAIN_MENU
cls
echo ============================================================
echo ULTIMATE WINDOWS UPDATE RECOVERY for WIN11 25H2
echo ============================================================
echo Y = Execute ^| N = Skip ^| X = Exit script
echo ============================================================
:: --- 1. CLEANUP & BACKUP ---
call :ASK_STEP "1. Delete old restore points and create a new clean System Restore Point?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
echo Deleting old Volume Shadow Copies...
vssadmin delete shadows /all /quiet >nul 2>&1
echo Creating fresh restore point...
powershell -command "Enable-ComputerRestore -Drive 'C:\'; Checkpoint-Computer -Description 'Before Master-Repair' -RestorePointType 'MODIFY_SETTINGS'"
)
:: --- 2. STOP SERVICES (Deep) ---
call :ASK_STEP "2. Stop all related services and WSUS orchestrator?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
echo Stopping services (Soft-Stop)...
net stop wuauserv /y & net stop bits /y & net stop usosvc /y & net stop appidsvc /y & net stop msiserver /y
net stop cryptsvc /y
echo Terminating Orchestrator worker...
taskkill /F /IM MoUsoCoreWorker.exe /T >nul 2>&1
)
:: --- 3. WMI REPAIR ---
call :ASK_STEP "3. Repair WMI Repository?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
net stop winmgmt /y
winmgmt /resetrepository
net start winmgmt
)
:: --- 4. REGISTRY, POLICIES & NETWORK RESET ---
call :ASK_STEP "4. Clear Registry cache, update flags & flush local network caches?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
echo Resetting Update Registry keys...
reg delete "HKCU\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f >nul 2>&1
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f >nul 2>&1
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v "PostRebootReporting" /f >nul 2>&1
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v "RebootRequired" /f >nul 2>&1
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\InProgress" /f >nul 2>&1
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Update\Orchestrator" /f >nul 2>&1
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\DataStore" /f >nul 2>&1
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v "SusClientId" /f >nul 2>&1
gpupdate /force >nul 2>&1
echo Flushing DNS and resetting Winsock...
ipconfig /flushdns >nul 2>&1
netsh winsock reset >nul 2>&1
)
:: --- 5. WSUS CACHE FOLDER DELETION ---
call :ASK_STEP "5. Backup and Purge WSUS Cache Folders? (\Software Distribution, \Catroot2)"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
echo.
echo [!] START LIGHTSPEED SERVICE KILL (Hard Kill + Bulldozer)
:: Immediate kill of the most stubborn service
taskkill /F /FI "SERVICES eq cryptsvc" >nul 2>&1
net stop cryptsvc /y >nul 2>&1
:: 1. Removing any previous / older backups
echo Cleaning up old .old residues...
if exist "%SYSTEMROOT%\SoftwareDistribution.old" rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution.old"
if exist "%SYSTEMROOT%\system32\catroot2.old" rmdir /s /q "%SYSTEMROOT%\system32\catroot2.old"
:: 2. Renaming active folders (Instant isolation)
echo Isolating active folders...
if exist "%SYSTEMROOT%\SoftwareDistribution" ren "%SYSTEMROOT%\SoftwareDistribution" "SoftwareDistribution.old"
if exist "%SYSTEMROOT%\system32\catroot2" ren "%SYSTEMROOT%\system32\catroot2" "catroot2.old"
:: 3. Deleting newly renamed folders to reclaim space
echo Executing Bulldozer deletion on isolated folders...
if exist "%SYSTEMROOT%\SoftwareDistribution.old" rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution.old"
if exist "%SYSTEMROOT%\system32\catroot2.old" rmdir /s /q "%SYSTEMROOT%\system32\catroot2.old"
:: --- RESET ORCHESTRATOR & BITS (Modern Windows 11 Logic) ---
echo Resetting Update Orchestrator and BITS Queue...
if exist "%ProgramData%\Microsoft\Windows\UpdateOrchestrator" rmdir /s /q "%ProgramData%\Microsoft\Windows\UpdateOrchestrator"
if exist "%ProgramData%\Microsoft\Network\Downloader" (
del /s /q /f "%ProgramData%\Microsoft\Network\Downloader\qmgr*.db" >nul 2>&1
del /s /q /f "%ProgramData%\Microsoft\Network\Downloader\qmgr*.jfm" >nul 2>&1
del /s /q /f "%ProgramData%\Microsoft\Network\Downloader\qmgr*.dat" >nul 2>&1
)
echo [+] Bulldozer sequence and BITS purge completed.
)
:: --- 6. SERVICE PERMISSIONS ---
call :ASK_STEP "6. Restore default permissions for services?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
sc.exe sdset bits D:(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU) >nul
sc.exe sdset wuauserv D:(A;;CCLCSWRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY) >nul
)
:: --- 7. TRANSACTION LOGS ---
call :ASK_STEP "7. Reset file system transaction logs?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
fsutil resource setautoreset true C:\ >nul 2>&1
del %SystemRoot%\System32\Config\TxR\*.* /q >nul 2>&1
)
:: --- 8. SERVICE START ---
call :ASK_STEP "8. Restart services?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
net start cryptsvc & net start bits & net start wuauserv & net start usosvc & net start appidsvc & net start msiserver
)
:: --- 9. DISM REPAIR ---
call :ASK_STEP "9. Perform DISM /RestoreHealth (Online via Windows Update) & Cleanup?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
echo Starting system repair via Windows Update. This may take a while...
DISM /Online /Cleanup-Image /RestoreHealth
echo Cleaning up WinSxS (StartComponentCleanup)...
DISM /online /cleanup-image /startcomponentcleanup
set /p rb="Execute ResetBase? WARNING: Uninstallation of old updates will no longer be possible! (y/n): "
if /i "!rb!"=="y" (
echo Executing final ResetBase...
DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBase
)
)
:: --- 10. SFC & CHKDSK ---
call :ASK_STEP "10. Run SFC Scan and schedule CHKDSK for reboot?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
sfc /scannow
echo j | chkdsk C: /f /r
)
:: --- 11. FINAL DIAGNOSTIC CHECK ---
call :ASK_STEP "11. Perform final connectivity and DNS integrity check?"
if "!ans!"=="X" goto :EOF
if "!ans!"=="Y" (
echo.
echo [Checking DNS/Hosts Integrity...]
powershell -command "$h = Get-Content 'C:\Windows\System32\drivers\etc\hosts'; if ($h -match 'microsoft.com' -and $h -match '127.0.0.1') { Write-Host '!!! BLOCKADE IN HOSTS-FILE DETECTED !!!' -Fore Red } else { Write-Host '[OK] Hosts-file clean.' -Fore Green }"
echo [Testing Connection to Microsoft Update Servers...]
powershell -command "if (Test-NetConnection -ComputerName slscr.update.microsoft.com -Port 443 -InformationLevel Quiet) { Write-Host '[OK] Connection to MS-Update (Port 443) successful.' -Fore Green } else { Write-Host '!!! CONNECTION FAILED: Check Firewall/Router !!!' -Fore Red }"
echo.
echo [+] Network checks passed. Windows Update is ready for a clean start.
)
echo.
echo ============================================================
echo REPAIR SEQUENCE COMPLETED - PLEASE REBOOT PC
echo ============================================================
pause
exit
:ASK_STEP
echo.
set /p userans="[?] %~1 (y/n/x): "
if /i "!userans!"=="y" (set ans=Y & exit /b)
if /i "!userans!"=="n" (set ans=N & exit /b)
if /i "!userans!"=="x" (set ans=X & exit /b)
goto :ASK_STEP
Zuletzt bearbeitet: