Like Windows Vista, the Disk Defragmenter in Windows 8 | 7 is automatically scheduled to run at 1.00 am, by default, which means that you don’t really need to run it manually. But if you find that you are unable to manually run the Windows 7 in-built defragmenter utility and you maybe, get error messages like
Disk defragmenter could not start or Failed to initialize
Here are a few steps you may want to try.
This may happen if you have un-installed a 3rd party defragmenter, and the uninstallation may not have gone correctly or may have been incomplete. You may try these suggestions in any order you wish; these are just some options you may want to try.
1. Click Start >Search Menu Bar >cmd >rt click on result > Run As Administrator > Type sfc /scannow > Hit Enter. This will run the System File Checker. This will examine all your system files and replace them if any are found to have been corrupted.
2. Type services.msc in start search and hit Enter.
In Windows 7 ensure that:
Disk Defragmenter service is not Disabled but set to Manual.
This service, defragsvc, is new in Windows 7 and used to defragment disks on a schedule. It does not run at start up, but starts & stops, as required on its own.
Also ensure that the following services are running and set on Automatic.
Remote Procedure Call (RPC)
DCOM Server Process Launcher
RPC Endpoint Mapper
3. Run chkdsk /r on the drive you plan to defragment. The /r switch identifies bad Sectors and attempts recovery of information.
4. Verify that the Page File isn’t turned off.
To do so, right click Computer > Properties > Advanced system settings > Advanced tab > Performance > Settings > Performance options > Virtual Memory > Change > Ensure that Automatically manage Paging file size for all drives is checked. Make sure that No paging file is NOT selected.
5. Try a System Restore.
Hope something helps!
This post on Best free defragmentation software for Windows may also interest you.