Skip to content

Instantly share code, notes, and snippets.

@germ13
Last active September 29, 2022 16:31
Show Gist options
  • Save germ13/a1fe9bfc4640654fc47905ec2e0bacfd to your computer and use it in GitHub Desktop.
Save germ13/a1fe9bfc4640654fc47905ec2e0bacfd to your computer and use it in GitHub Desktop.
Fix Stuck Windows Updates
@ECHO OFF echo This script is intended to stop fix broken windows updates
REM Changing folder and file permissions for locked files
attrib -h -r -s %windir%\system32\catroot2
attrib -h -r -s %windir%\system32\catroot2\*.*
REM Stopping services that lock relevant files
net stop wuauserv
net stop CryptSvc
net stop BITS
REM Creating backups of folders
ren %windir%\system32\catroot2 catroot2.old
ren %windir%\SoftwareDistribution SoftwareDistribution.old
ren "%ALLUSERSPROFILE%\application data\MicrosoftNetwork\downloader" downloader.old
REM Restarting services
net Start BITS
net start CryptSvc
net start wuauserv
@germ13
Copy link
Author

germ13 commented Sep 29, 2022

Hello Memo. Hope this works. Its attempting to clear out the files that are locked and preventing the update.

  • Open up a command prompt with Administrative access. Hit Windows keys, type in CMD and then right click on "command prompt" and select "Run as Admistrator"
  • Copy each one of the commands above (one by one) and paste into the the Command Prompt window
  • After this go to Windows Settings and try the update again.
  • Update should resume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment