iwr 'https://raw.githubusercontent.com/AnassKartit/WindowsUpdateTroubleshooter/main/fixupdate.ps1' -UseBasicParsing | iex
You can use the following command to run the script from PowerShell using iwr and iex:
A collection of commands to help in solving We couldn’t complete the updates. Undoing changes. Don’t turn off your computer. In admin mode, launch powershell command:
SFC /SCANNOW
2. If there are problems with the system image, use DISM with the RestoreHealth option to automatically scan and repair common issues.
DISM.exe /Online /Cleanup-Image /Restorehealth
$path = "C:\Windows\SoftwareDistribution"
Get-ChildItem -Path $path -Recurse | Remove-Item -Force -Recurse
chkdsk /F /R /X /B /scan /offlinescanandfix