Windows Server Cookbook for Windows Server 2003 and Windows 2000
Recipe 4.19. Finding Open Files
Problem
You want to find the open files on a server. Solution
There are two different categories of open files on a system. Since the days of Windows NT, the operating system has supported the capability to view the files that are open from shared folders. This is useful when you want to see who is accessing files on a file server, especially if you need to take the system down for maintenance and you want to notify the impacted users. First seen in Windows XP and supported in Windows Server 2003 is the ability to view all open files on a system (not just shared folders). To use this feature, you first have to enable support for it. The reason this isn't enabled by default is because there is a slight system-wide performance impact when tracking all open files. Using a graphical user interface
None of the standard graphical tools provide a list of the open files on a system. The closest thing to it would be the Sysinternals File Monitor tool. For more information, see Recipe 4.21. To view the open files from shared folders, do the following:
Using a command-line interface
To view the open files from shared folders, run this command: > net file
The output from that command displays open files and their associated ID. Using this ID, you can close a specific file: > net file <ID> /close
To view all open files, first enable support for it: > openfiles /local on
You'll need to reboot the system before this setting takes effect. At that point, you can see open files using this command: > openfiles
Use the /s <ServerName> option to target a remote server. Similar to the net file command, you can close any open file by running this command: > openfiles /disconnect /id <ID>
You can also disconnect all the files open by a particular user: > openfiles /disconnect /a <UserName>
See Also
Recipe 4.21 |