Recipe4.19.Finding Open Files


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:

  1. From the Administrative Tools, open the Computer Management snap-in.

  2. In the left pane, expand System Tools Shared Folders

    To close an open file, right-click on it in the right pane and select Close Open File.

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



Windows Server Cookbook
Windows Server Cookbook for Windows Server 2003 and Windows 2000
ISBN: 0596006330
EAN: 2147483647
Year: 2006
Pages: 380
Authors: Robbie Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net