When do changes to the Registry get saved?
Such updates to the registry are not flushed right away to the disk. Instead of this, what the new operating system does is that the modified registry data is flushed to the disk regularly in short intervals of time. Now, after changes are made to the registry, if you are faced with a scenario where the computer shuts down immediately, due to power failure or any such unexpected reason, the registry changes may not get saved. In this case, you may find that, when you start your PC back, the application may not work correctly and the registry changes may not be visible at all. In fact, even the newly installed driver may appear NOT to have been installed – or the uninstalled drivers may continue to appear as being installed. In such situations, you should make the registry changes, install or uninstall the software or driver once again. All pending disk write requests, including such registry changes are saved to disk before the machine is powered down, that is, during Shutdown, Restart, Hibernate and Sleep options. Do note that if you have set the power button to Do Nothing, via Power Options, the pending disk writes will not be saved.
If you wish, you can make Windows write the registry modifications immediately to disk. For this, you will need to use the RegFlush API. However, this operation is expensive in terms of resources used and may affect your system’s performance. KB2784761 says that this is therefore done this way, to maximize the performance in Windows 11/10.