Windows Registry cleanup control

Windows has an automatic event in which some registry entries are purged. I see this event in the Event Viewer with the ID=16. It seems that the cleanup is frequently triggered by Windows Update. In my Java application I store data in [Computer\HKEY_USERS<SID>\Software\JavaSoft\Prefs] and this gets frequently deleted. (I am protecting the data using DPAPI - thus not using the HKLM)

  1. Is there a way for me to trigger this clean up job so I could study exactly what is going on?
  2. Is there a way to prevent the automatic cleanup from touching a specific registry key?

Solution 1:

It's normal for Windows to do registry cleanup from time to time. The event, as you found, is Event ID: 16.

This can be a very aggressive registry cleanup, and even more so after a major Windows update, up to requiring for some applications to be re-installed.

If your app suffers also from this problem, try to change the location in the registry in which your data is stored, or move it into a file, to protect it from Windows. As far as I know, there is no other solution to protect your data.