News Stay informed about the latest enterprise technology news and product updates.

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

A manager for Microsoft's internal IT organization explains how to identify the process that 'locks' a file from use by other processes in Windows 2000 Server.

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 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:
Handle.exe is a free download from Sysinternals at:
-- Mike Mercer

Dig Deeper on Microsoft Hyper-V management

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.