openfiles | new in WS2003 |
Displays or disconnects files opened by local or network users.
openfiles / command switches
Specifies the action to perform, which can be:
Displays all open files
Disconnects one or more open files
The full syntax for these two commands is:
/query [/s Computer [/u Domain \ User [/p Password ]]] [/fo {TABLE LIST CSV}] [/nh] [/v]
and:
/disconnect [/s Computer [/u Domain \ User [/p Password ]]] {[/id OpenFileID ] [/a UserName ] [/o OpenMode ]} [/op OpenFileName ]
The various switches are:
Name or IP address of a remote computer (if omitted, defaults to local computer) and credentials for running the script (if omitted, defaults to System built-in identity).
Format for displaying driver properties (if omitted, default is TABLE ).
Omits header row from displayed information if /fo is set to TABLE or CSV .
Displays verbose information.
Disconnects an open file with a specific numeric ID (use openfiles /query to find the ID). A wildcard (*) can also be used to disconnect all open files.
Disconnects all open files for a specific user. A wildcard (*) can also be used.
Disconnects all open files by OpenMode value (Read, Write or Read/Write). A wildcard (*) can also be used.
Disconnects all open file connections created by a specific OpenFile name. The wildcard (*) disconnects all open files on the specified computer.
List open files on member server with IP address 172.16.11.230:
openfiles /query /s 172.16.11.230 /fo list ID: 41 Accessed By: ADMINISTRATOR Type: Windows Open File (Path\executable): C:\caps ID: 104 Accessed By: ADMINISTRATOR Type: Windows Open File (Path\executable): \PIPE\srvsvc
Disconnect open file with ID 41:
openfiles /disconnect /s 172.16.11.230 /id 41 SUCCESS: The connection to the open file "C:\caps" has been terminated.
Verify the result (verbose mode):
openfiles /query /s 172.16.11.230 /fo list /v Hostname: ESRV230D ID: 111 Accessed By: ADMINISTRATOR Type: Windows #Locks: 0 Open Mode: Write + Read Open File (Path\executable): \PIPE\srvsvc
Files and Folders