As always, I try to post up IT fixes that may be a little tougher to find, and only if the fix is proven to actually work, so you’re not scrolling amongst 100s of forum posts. One useful command from back in the day, “sfc /scannow” used to be used to fix corrupted files in Windows installations, although its been a bit of a meme over the past few years (decades?) in that it was almost universally suggested by online Microsoft support, yet rarely ever fixed anything. (Rarely being used liberally here – it DID work…sometimes). Yet, what happens when SFC doesn’t work, and instead spits out an error?
In this case, the patient was a nearly freshly installed Windows Server 2022. Somehow, a single DLL file got corrupted along the way, and was occasionally popping up an error. In trying to use sfc /scannow to fix it, it showed that the “source” file was even corrupted (likely what caused this file itself to be corrupted). So how does one fix this?
CREDIT: Credit is due to topgundcp in this post; even though its a Windows 10 post, Windows 10 and Windows Server 2022 share many components and fixes that work for one generally work for the other: https://www.tenforums.com/performance-maintenance/29947-sfc-some-corrupt-files-can-not-fixed-post464894.html#post464894
Well the suggested commands are to use DISM to “repair” the Windows install, like this:
DISM /Online /Cleanup-Image /RestoreHealth
However, what happens when even THIS fails? (Cannot find source) Well if you have an install ISO that matches that Windows version installed, you can mount it (twice) to use it as the source for DISM. First, mount the ISO file which should present itself as a drive. After that…
DISM /mount-wim:x:\sources\install.wim /mountdir:c:\sxs /index:1 /readonly
Once you do the above command, you now have a factory Windows image mounted at c:\sxs (yes the folder had to be created before using it as a mount point). You can now use the same dism command from above to do your image fix:
dism /online /cleanup-image /restorehealth /source:c:\sxs /limitaccess
Once this completes, your source files should be fixed, and you can now run sfc /scannow to fix and repair any corrupted files. Hopefully this works! If so, you can un-mount the win by using:
dism /unmount-wim:x:\sources\install.wim /mountdir:c:\sxs /discard