Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know that Windows uses its defrag program to defragment my partition sometimes when my system goes to an idle state. Also, sometimes I used to execute defrag by myself in order to increase utilization and boot time performance.

But, is there a way to know if it was already executed ever, when it happened and how many times? Does Windows keep some log in its registry or in the event manager which would reveal such information?

share|improve this question

4 Answers 4

I believe that you have to create a scheduled task for it to log the activity. It's possible you can set up a .bat file as well to do the logging. I've always thought it to be odd regarding some of the tasks that are not logged automatically in Windows.

share|improve this answer

I'm going to argue that you're asking the wrong question, because of one small fact: why do you care how often a drive has been defragmented? How would you know if those defrag operations all completed successfully? What purpose would that information serve to you?

You shouldn't care how often a drive is defragged, but you should care how much it's fragmented, especially when it gets to the point of impacting performance. I personally don't know what point that is, but I know on Windows, you can run defrag X: /a /v to view a verbose (/v) analysis (/a) of the drive before defragmenting it. This will provide you with an approximate percentage of how fragmented the disk is.

In my opinion, anything higher then a few percent is worth a quick defrag pass. It would be trivial to write a batchfile to automate this for you, to only defrag the hard drive if it reaches a certain threshold. In that same batchfile, you could also log to a file when you executed the defrag job, so you could keep count if you wanted. As ioi also mentioned, you could also use a scheduled task to do this.

share|improve this answer

The Windows Disk Defrag automatically makes a log entry every time it finishes, but not every time it fires up though.

When Disk Defrag finishes, you can go into Event Viewer and look in the Application log. Filter the log by Source and pick Defrag.

share|improve this answer
up vote 1 down vote accepted

I found two possibilities:

  1. Windows Registry: regedit

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\Statistics\Volume{GUID}\LastRunTime
    

    Here I found ah hex value that I think that if the last defrag run date. On the Statistics registry folder there is a lot of other useful statistics, such as DirectoryCount, FragmentedFiles, etc....

  2. On Windows Scheduled Tasks
    Here there is a scheduled task called "SchedueledDefrag". Here I can see the next execution date and, if the schedule history was previouslly enabled, I can see the last run date.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.