ntuser.dat
is a registry hive file that contains the registry entries associated with the profile. The kernel itself has the file open; the hive has to unloaded to unlock the file. You can force it to unload with reg unload
, though you'll need the SID of the user that owns the profile. There is a related "classes" hive that expands HKEY_CLASSES_ROOT
for each profile as well.
reg unload HKEY_USERS\S-1-5-21-1555713158-3015222722-1959872020-2924
reg unload HKEY_USERS\S-1-5-21-1555713158-3015222722-1959872020-2924_Classes
This applies to all versions of Windows since XP and there is something similar in all the previous versions of WinNT as well.
In general, it would be better to let Windows unload the profile itself, by removing the open references to it.