Recently I’ve come across some issues with one of my Windows Server installations, which was behaving relatively odd. Big surprise, right? After doing some digging around, I’ve come up with a complete set of commands that checks the system health and repairs any corruption that may have occurred with system files.

Feel free to run these in the order mentioned below if your system is having stability issues or other strange and frustrating problems.

SFC /scannow

This classic command also known as System File Checker tool checks for corruption in Windows system files and restores corrupted files. This is the first tool that we always run to check for issues in system integrity and try to auto-resolve them.

DISM /Online /Cleanup-Image /ScanHealth

This tool is used in case SFC does not find any corruption or was not very helpful at fixing the issue. With DISM, we can service an offline windows image (WIM) or VHD file, or an online Windows Image.

The “/ScanHealth” switch scans the online image for corruption and detects if there are any issues.

DISM /Online /Cleanup-Image /CheckHealth

After running the first command we need to run the same command with the “/CheckHealth” to see if any corruption has been detected. After the command finishes running it will report if the image is healthy, repairable or unrepairable.

DISM /Online /Cleanup-Image /RestoreHealth

In case we found corruption on the image, we will run the same command with the “/RestoreHealth” switch that will auto-correct any corruption. This may take about twenty minutes to complete.

DISM /online /Cleanup-Image /SPSuperseded

This optional switch, “/SPSuperseded”, will remove any superseded updates and service packs from the Winsxs folder, to free up space on systems with low disk space on the OS drives.

Hopefully, you system performance and stability will be improved after running the above-mentioned commands. Enjoy!