The OpenFiles command helps
you track open shared files on any system of a network. This utility has
a number of purposes, but the most important is to ensure that a system
has no shared files open before shutting it down. Even though Windows
performs an orderly shutdown on the server, the client may have data
stored in a local cache that could get lost when the server shuts down.
You could also use this utility to look for signs of unwanted intrusion
(either locally or from a remote source). A shared file that you can't
account for could indicate the activities of a cracker or a disgruntled
employee. The OpenFiles utility has three modes of operation,
DISCONNECT, QUERY, and LOCAL, which are discussed in the sections that
follow.
1. Disconnect
This mode disconnects a
user or closes a file. You can use this mode to force a closure. In some
cases, you might find this necessary when an application terminates
abnormally and leaves the file in an uncertain state. This mode uses the
following syntax:
OPENFILES /Disconnect [/S system [/U username [/P [password]]]]
{[/ID id] [/A accessedby] [/O {Read | Read/Write | Write}]}
[/OP openfile]
The following list describes each of the command line arguments.
Always disconnect
users or close files with care. Pursue every other possible means of
disconnecting the user or closing the file before you use the DISCONNECT
mode. Disconnecting users or closing files using this technique may
corrupt the data file or cause the application to lose data because this
method doesn't consider any of the data that appears in the application
cache.
|
|
/S
systemSpecifies the remote system that you want to check. In most cases, you'll also need to supply the /U and the /P command line switches when using this switch.
/U
[domain\]userSpecifies the
username on the remote system. This name may not match the username on
the local system. You'll need to supply a domain name when working with a
domain controller.
/P
[password]Specifies the
password for the given user. You can provide the command line switch
without specifying the password on the command line in cleartext. The
system prompts you for the password. Using this feature can help you
maintain the security of passwords used on your system.
/ID
idSpecifies the
identifier of the file to disconnect. You may use the * wildcard to
disconnect all currently shared files by identifier. Use the OPENFILES
/Query mode to obtain the list of files currently open on the system,
including the file identifier.
/A
usernameDisconnects all files
opened by a particular user as specified by username. You can use the *
wildcard to disconnect all currently shared files by username. Use the
OPENFILES /Query mode to obtain the list of files currently open on the
system, including the username.
/O {Read | Read/Write | Write}
Closes all files
opened in a particular mode. The valid values include read, read/write,
and write. You can use the * wildcard to disconnect all currently shared
files by open mode. Use the OPENFILES /Query /V mode to obtain the list
of files currently open on the system, including the open mode. Note
that the standard display doesn't include the open mode, so you must
specify the /V command line switch.
/OP openfile
Disconnects
all open file connections created by a particular open filename. You
can use the * wildcard to disconnect all currently shared files by
filename. Use the OPENFILES /Query mode to obtain the list of files
currently open on the system, including the name of the open file.
2. Query
Use this mode to obtain a list of the files currently open on a system. This mode uses the following syntax:
OPENFILES /Query [/S system [/U username [/P [password]]]]
[/FO {TABLE | LIST | CSV}] [/NH] [/V]
The following list describes each of the command line arguments.
/S
systemSpecifies the remote system that you want to check. In most cases, you'll also need to supply the /U and the /P command line switches when using this switch.
/U
[domain\]userSpecifies the
username on the remote system. This name may not match the username on
the local system. You'll need to supply a domain name when working with a
domain controller.
/P
[password]Specifies the
password for the given user. You can provide the command line switch
without specifying the password on the command line in cleartext. The
system prompts you for the password. Using this feature can help you
maintain the security of passwords used on your system.
/FO {TABLE | LIST | CSV}
Defines the
output provided by the utility. The table format is normally the easiest
to view on screen. The table columns define the values for output,
while each row contains one driver entry. The CSV output provides the
best method for preparing the data for entry in a database. Use
redirection to output the CSV data to a file and then import it to
your database. The list format provides one data element per line. Each
group of data elements defines one driver. The utility separates each
driver by one blank line. Some people find the list format more readable
when working in verbose mode since the table format requires multiple
lines for each entry (the lines wrap).
/NH
Forces the utility
to display the data without a column header. You can only use this
command line switch with the table and CSV formats. Omitting the header
makes it easier to incorporate the data in a report or import it into a
database.
/V
Displays
detailed file information. The standard display includes the file
identifier, accessed by information, file type, and filename complete
with path. The extended information provided by this command line switch
includes the hostname (server), number of locks, and the mode used to
open the file (read, read/write, or write).
15.9.3. Local
This mode uses the following syntax:
OPENFILES /Local [{ ON | OFF }]
The following describes the command line argument.
{ ON | OFF }
Enables
or disables the "maintain objects list" system global flag. The state
of this flag determines whether the system tracks the state of local
file handles. Enabling this flag adds overhead, which reduces
performance, and also lets you track the status of shared files on your
system. Calling the OPENFILES /Local mode without using this command
line switch at all displays the current flag status, which is disabled
on Windows systems.