Is there an event or other means by which a VB.NET program can be notified when a Windows 7 defrag has completed (so the program can instruct the PC to shut down)?
Asked
Active
Viewed 290 times
1 Answers
2
You should be able to use EventLog.EntryWritten event to monitor for events. On Windows 7, an event in Application
log with Source = "Defrag"
may indicate completion of defragmentation. You can then examine the id - should be 258, and description will say something like The disk defragmenter successfully completed defragmentation on (C:)
.
Here is a screenshot from my home PC to prove the above:

Victor Zakharov
- 25,801
- 18
- 85
- 151