Here is a central list of things to do, in order to repair and clean up a Windows 10/11 installation.
All commands must be run in a Administrator Terminal. Right-click on the Windows symbol and select Terminal (Admin) or Powershell (Admin).
Repair
DISM can be used to check and repair the Windows Component Store:
Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /RestoreHealth
SFC is used to check and repair Windows system files:
sfc /SCANNOW
Cleanup
Remove old updates using DISM: (You won’t be able to uninstall any previous updates after.
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
Then clean unused files on the disk:
cleanmgr /lowdisk
Antivirus
Windows has a built in antivirus called Defender that is active by default and does not need to be replaces.
If you are uncertain wether you might have caught something, download the Microsoft Safety Scanner and let it run a full scan (overnight)
Links
Further reading:
https://woshub.com/dism-cleanup-image-restorehealth
https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/clean-up-the-winsxs-folder