Tuesday, April 22, 2014

How do I tell when ChkDsk was last run?

An interesting question popped up at work today.
Question: Is there a way to tell if ChkDsk is being run at regular intervals and see what the results are?
Answer: Yes!  There is an event written to the Application Event Log when chkdsk is run.  To view it, run eventvwr.msc.  In the left-side navigation pane expand "Windows Logs".  Then select the Application Log.

Note: If clicking through thousands of events one-at-a-time isn't your idea of "fun", there are a couple of handy event log search features.  Since you know the event IDs in this case, you can filter the output using the "Filter" options in the right-side action pane.  Alternately you can right-click "Application" in the navigation pane, select "Find", and search for "chkdsk" (no quotes).

If chkdsk is run in offline mode at boot time, either for a dirty filesystem or because it's forced, then the output will be in the Application Log WinInit event id 1001.
Wininit Event Id 1001 Offline Chkdsk output
If chkdsk is run in online mode (without rebooting) then the output will be in the Application Log Chkdsk event id 26212.
Chkdsk Event Id 26212 Online Chkdsk output
These events were captured from a Windows 7 machine.  I suspect the behavior also exists in Windows Vista, but you should confirm that empirically instead of taking my hunch.

When I tested my Windows 8.1 machine, I got the same event for the offline scan, but the online scan gave me chkdsk Event ID 26226.
Windows 8.1 Chkdsk online scan EventID 26226

Bonus tip, to schedule an Offline Chkdsk scan for your next reboot, run fsutil dirty set c:.
The action center will pop up and tell you to reboot.  At the reboot, chkdsk runs.  Magic!


No comments: