Article

Ask Microsoft: How can I identify locked files in Windows 2000 Server?

SearchWinComputing.com staff

On a regular basis, top Microsoft executives answer readers' toughest technical questions about Windows-based systems. This installment of "Ask Microsoft" was answered by Mike Mercer, Microsoft Remote IT Services, GTS.

Question: I am often confronted with a problem in Windows 2000 Server where I need to determine which process has locked a particular file. If I can figure out how to do that, I can kill it rather than have to restart the server. Is there an easy way to do that?

Answer: Most often this issue occurs when you want to delete a file and you receive the error message stating "The process cannot access the file because it is being used by another process."

In order to identify the process that has 'locked' the file from use by other processes you can run one of two command line tools. One option from the Windows 2000 Resource Kit is "OH.exe" (Open Handles). Another option is a third party tool developed by Sysinternals called "handle.exe". Both tools will identify the process that has a lock on the file. You can then use either Task Manager or the command line execution of "kill.exe " to end the process. You should then be able to delete the file.

The one disadvantage to using OH.exe is the first time you attempt to use OH.exe it will prompt for a reboot. The reason for this is that OH.exe needs to enable a kernel option that makes tracking the handles possible while

    Requires Free Membership to View

using this tool.

A side note would be that if you find that the process that has locked the file is the 'system' process, use 'net files' tool from the command line to identify the user that has the file open over a network share.

OH.exe is a free download from Microsoft at: http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/oh-o.asp.
Handle.exe is a free download from Sysinternals at: www.sysinternals.com
-- Mike Mercer


There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: