Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying files in C:\Windows\WinSxS\ breaks Windows Update and system file checker (sfc) #297

Closed
WayneSherman opened this issue Nov 26, 2021 · 2 comments

Comments

@WayneSherman
Copy link

After running these scripts, I have experienced broken Windows update and broken system file checker (sfc /scannow fails to repair). I expended much effort trying to repair the systems which were affected, but ended up having to do a fresh install of Windows.

I finally discovered the cause was the "remove-onedrive.ps1" script was deleting files in the WinSxS folder.

Please remove these lines:

Write-Output "Removing additional OneDrive leftovers"
foreach ($item in (Get-ChildItem "$env:WinDir\WinSxS\*onedrive*")) {
Takeown-Folder $item.FullName
Remove-Item -Recurse -Force $item.FullName
}

For reference, here are warnings from three different sources:

https://www.tenforums.com/general-support/155313-winsxs-folder-outdated-hardware.html
You should never ever manually delete anything in WinSxS or you risk breaking the system. The only safe way to clean up WinSxS is with the tools MS provide.

https://superuser.com/questions/1621421/can-i-safely-delete-all-inside-the-c-windows-winsxs-temp-folder-only
Don't manually replace winsxs files (or even touching winsxs). The supported mechanism is technet.microsoft.com/en-us/library/Dn251565.aspx Definitely do not mess with winsxs. Some of the versions may be removable by running dism /online /cleanup-image /startcomponentcleanup. Anything that remains after that should be left alone

https://www.ionos.com/digitalguide/server/configuration/winsxs-cleanup/
Most importantly, however, you should never manually delete files from the WinSxS folder. This can significantly affect your system's ability to function.

@WayneSherman
Copy link
Author

These two issues are probably for the same reason:
Issue #248 and Issue #288

@W4RH4WK
Copy link
Owner

W4RH4WK commented Nov 26, 2021

Thanks for figuring out what caused the issue. Hope this is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants