How to scan and repair Windows virtual machine if its system files are corrupted

1625 users found this article helpful

Symptoms

Cause

Windows file system/registry corruption.

Resolution

  1. Open Windows Start menu, in Search bar type cmd, right-click on the appeared Command Prompt application and choose Run as Administrator.

  2. In Command Prompt execute the command below:

    chkdsk /f /r
     
  3.  When asked to schedule checking disk, type y, and press "Enter" again. Reboot Windows and wait until the CHKDSK finishes checking the disk and fix the detected errors if such were found.
  4.  Open Command Prompt again as Administrator and execute the following command:

    sfc /scannow

  5. Wait for the scanning and the repairing processes to finish.

  6. There is a chance you might get the following message at the end of the scanning procedure:

        Windows Resource Protection found corrupt files but was unable to fix some of them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not supported in offline servicing scenarios
    
    alttext

    It means that typical scanning/repairing utility is not enough to fix Windows files corruption, to be able to fix it, please do not close Command Prompt window and proceed with the instructions:

  7. In Command Prompt execute the following commands one by one:

    DISM /Online /Cleanup-Image /CheckHealth
    DISM /Online /Cleanup-Image /ScanHealth
    DISM /Online /Cleanup-Image /RestoreHealth

    DISM commands

     

  8. In case you have Windows installation media (CD/DVD disk or .iso image), please do the following:

  9. Make sure Windows is connected to the Internet.

  10. Insert CD/DVD or put an .iso file to the easiest location on the Mac to use it later.

  11. From Mac top menu choose Devices > CD/DVD

  12. If you use physical CD/DVD, choose CD/DVD drive from the list.

  13. If you use .iso image, choose Connect image... and navigate to the image location.

  14. Double-click it and check that it appeared inside Windows as drive D:

  15. In Command Prompt execute the commands from step 7 one by one changed in the following way:

    DISM /Online /Cleanup-Image /CheckHealth /source:wim:D:\sources\install.wim:1 /limitaccess
    DISM /Online /Cleanup-Image /ScanHealth /source:wim:D:\sources\install.wim:1 /limitaccess
    DISM /Online /Cleanup-Image /RestoreHealth /source:wim:D:\sources\install.wim:1 /limitaccess
    

    where D: is the Windows installation image mounted in a virtual drive.

    Wait until the operation is completed. This usually takes 20-30 minutes.

  16. Restart the virtual machine.

  17. If the situation did not change after the restart, the only thing left is to reset Windows.

If Windows updates fail to install, the operating system repair method from the official Microsoft knowledge base may help.

Was this article helpful?

Tell us how we can improve it.