When Windows says that NTUSER.DAT is in use, it usually means a user profile or application still has the file open. NTUSER.DAT is an important part of a Windows user profile: it stores that user’s registry settings and is loaded while the account is signed in. If you need to copy, rename, repair, or otherwise work with the file, the safest solution is usually to close the session that is using it—not to force-close the file handle.
This guide explains how to close NTUSER.DAT safely, how to handle a hive that you mounted yourself, and what to do when Windows continues to report that the file is locked. The steps apply to Windows 10 and Windows 11. Because this file contains profile settings, back it up before making changes and avoid deleting it as a way to resolve a lock.
What Is NTUSER.DAT?
NTUSER.DAT is a hidden registry hive located in each Windows user profile, commonly at C:\Users\YourUserName\NTUSER.DAT. When that user signs in, Windows loads the hive into the Registry under HKEY_CURRENT_USER. Applications and Windows components read and update settings in the loaded hive during the session.
Because Windows actively uses the file while the account is signed in, it normally cannot be edited, moved, or copied like an ordinary document. A lock on the file is often expected behavior rather than a sign that something is wrong. Windows may also create related transaction-log files in the profile folder to help protect registry changes.
Before You Try to Close NTUSER.DAT
First, identify which user profile and operation are involved. If you are trying to copy the file, back up a profile, or replace a damaged hive, note the full path and the exact error message. Make sure you have permission to access the profile and that you have a separate backup of any important user data.
- Do not delete
NTUSER.DATto remove a lock. Doing so can damage the user profile or cause Windows to create a temporary profile. - Do not use a handle-closing utility to forcibly close the active registry hive. Windows may be writing settings to it, and forced closure can cause data loss or profile corruption.
- Save open documents and close applications before signing out or restarting.
- If this is a work-managed computer, follow your organization’s IT procedures before changing profiles or registry settings.
Method 1: Sign Out of the User Account
The most reliable way to close the active NTUSER.DAT hive is to sign out of the account that owns it. Signing out ends the user session and gives Windows an opportunity to save registry changes and unload the hive cleanly.
- Save your work and close open applications in the account whose profile contains the file.
- Open the Start menu, select your account icon, and choose Sign out.
- Wait for the sign-in screen to appear. Do not simply switch to another account, because switching users may leave the original session running.
- From a separate administrator account, try the file operation again.
If you are signed in to the account you want to work with, signing out means you will need another account with appropriate access. If there is no separate administrator account, consider restarting the computer and performing the operation before signing back in to the target account.
Method 2: Sign Out Other User Sessions
A profile can remain loaded even when its owner is not looking at the desktop. For example, another person may have used Switch user instead of signing out, or a Remote Desktop session may still be active. In that case, signing out of your own account will not close the other user’s hive.
To check for other sessions, open Task Manager with Ctrl + Shift + Esc, select the Users tab, and review the listed accounts. If you are an administrator and have confirmed that a session can be ended, select that user and choose Sign off. Unsaved work in that session may be lost, so contact the user first whenever possible.
On managed computers or servers, ask the administrator to check for disconnected Remote Desktop sessions. Do not terminate a session if you are unsure who is using it or whether an important task is running.
Method 3: Restart Windows
If the account has been signed out but the file remains locked, a restart can clear a stale session or process that is holding the profile open. Save your work, restart Windows, and sign in with a different administrator account if you need to access the target profile while it is not loaded.
Choose Restart rather than relying on sleep or switching users. A restart closes active sessions and starts Windows again, while sleep may preserve them. If a shutdown or restart is blocked by a running application, close that application normally rather than terminating unknown system processes.
Method 4: Unload a Hive You Mounted Manually
If you used Registry Editor or a command to load an offline NTUSER.DAT file under a temporary registry key, you must unload that mounted hive when you finish. This is different from closing the active hive of a signed-in user. Only unload a key that you personally mounted and can identify.
In Registry Editor, select the temporary hive’s root key under HKEY_USERS, such as HKEY_USERS\OfflineUser. Then open the File menu and choose Unload Hive. Confirm the prompt. The temporary key should disappear from Registry Editor, and the file should no longer be held by that mounted hive.
You can also unload a manually mounted hive from an elevated Command Prompt. Replace TempHive with the exact temporary key name you used:
reg unload HKU\TempHive
Do not substitute HKCU or a live user’s loaded SID for the temporary key. Windows manages the active user hive as part of the signed-in session; attempting to unload it can fail or cause serious problems. If you are unsure whether a hive is temporary or active, stop and ask an administrator before proceeding.
Method 5: Find What Is Still Using the File
If signing out and restarting do not resolve the lock, a background process or service may be keeping a profile loaded. Microsoft Sysinternals Process Explorer can help an experienced user search for an open handle. Download it only from Microsoft’s official Sysinternals site, run it with appropriate permissions, and use its search feature to look for the file name or full path.
Use this information to identify the responsible application or session, then close that application normally or sign out the associated user. Do not choose a command that forcibly closes the handle. Closing an individual handle without allowing the program or Windows to finish its work can corrupt data, destabilize the application, or damage the registry hive.
If the process belongs to Windows, security software, backup software, or a management tool, do not end it based only on its name. Contact your IT administrator or the software vendor for guidance. A process may be performing a legitimate scan, backup, or profile-management task.
How to Copy NTUSER.DAT Safely
If your goal is to back up or copy the file, the safest approach is to make the copy while the user is signed out. After confirming that the correct account is no longer active, copy the file to a secure location using File Explorer or an approved backup tool. Keep the original file unchanged until you have verified the backup.
For a full profile backup, copying only NTUSER.DAT is usually not enough. The profile may contain documents, application data, desktop settings, and other registry-related files. Use Windows Backup or your organization’s approved backup solution when possible. Avoid copying a profile while it is actively being updated, because the resulting copy may be incomplete or inconsistent.
Some backup products can capture files that are in use by using Windows-supported snapshot technology. If you use such a product, follow its instructions rather than trying to bypass the file lock manually.
What to Do If NTUSER.DAT Is Damaged
A locked file is not necessarily a damaged file. If Windows reports profile errors, signs you in with a temporary profile, or repeatedly fails to load the account, the problem may involve the user profile or registry hive. Back up accessible data first, then check the exact Windows error and consult your administrator or Microsoft support guidance.
Do not replace the hive with a file from another user or another computer. Registry settings are specific to a profile and may not match the applications or Windows configuration on the affected device. Also avoid deleting files with related names, such as transaction logs, unless a trusted repair procedure explicitly calls for it.
Common Mistakes to Avoid
- Switching users instead of signing out: The original account may remain active and keep its hive loaded.
- Trying to unload the live user hive: Only unload a temporary hive that you mounted yourself.
- Forcibly closing a file handle: This can interrupt registry writes and damage the profile.
- Changing permissions unnecessarily: Altering ownership or access controls does not unload a hive and can create new access problems.
- Deleting or renaming the file while Windows is using it: This can prevent the user profile from loading correctly.
Conclusion
To close NTUSER.DAT safely, sign out of the account whose profile contains it, make sure no other session is still active, and restart Windows if the file remains locked. If you mounted an offline hive yourself, unload that specific temporary key through Registry Editor or the reg unload command. Avoid forcing a handle closed, deleting the file, or unloading a live user hive. These precautions help protect the Windows profile and its registry settings while allowing you to complete the file operation safely.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.