Automatic Maintenance in Windows 10/8 is expected to complete in a short while, say 10-20 minutes. But at times, many users find that it runs for hours together with no signs of stopping.

If you face this issue, here are a few things you could try:

  1. Stop Automatic Maintenance manually.
  2. Run sfc /scannow to start the system file checker. Restart your computer at the end, when you are asked to
  3. Use CCleaner to clear your PC junk, including your Page file, Prefetch files, etc.
  4. Disable your start up items temporarily, including your antivirus software.
  5. Start Automatic Maintenance manually and see if it helps.

Once done, you may re-enable your start-up items and your antivirus software.

If this doesn't help, maybe its some hardware, possibly RAM, issue.