PsFile (SysInternals)

Show files opened remotely, or close an open file (kill file locks)

Syntax
      psfile [\\Computer [-u User [-p Passwd]]]  [[Id | path]  [-c]]

Options:

   computer   The remote computer on which to list files. Default = local system 

              
   -p passwd  Specify a password for user (optional). Passed as clear text.
              If omitted, you will be prompted to enter a hidden password.

   -u user    Specify a username for login to remote computer(optional).

   Id         Identifier (as assigned by PsFile) of the file for which to display info or to close.

   Path       Full or partial path of files to match for information display or close.

   -c         Close the files identifed by ID or path.

   -accepteula Suppress the display of the license dialog.

Unlike the NET FILE command, PsFile does not truncate long filenames.

When installing psfile.exe just ensure it is placed somewhere in either the system PATH or in the current directory.

When launched for the first time, PsFile will prompt you to accept the EULA.
You can avoid this by writing the license registry key:

Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Sysinternals' -Name 'EulaAccepted' -Value 1

Examples

List all the files on \\workstation64 that have been opened remotely:

psfile \\workstation64

“Faith does not consist in the belief that we are saved; it consists in the belief that we are loved” ~ Alexandre Vinet

Related commands

NET FILE - Display all the open shared files on a server and the lock-id.
OPENFILES - Query or display open files.
Equivalent bash command (Linux): inotify - file-monitoring mechanism


 
Copyright © 1999-2024 SS64.com
Some rights reserved