PowerShell 查看远程打开的文件


如何查看自己机器上的共享文件正在被访问,可以使用CMD中的命令openfiles. openfiles命令需要以管理员权限才能运行,否则会提示:ERROR: Logged-on user does not have administrative privilege.
如果当前没有共享文件被访问:

PS C:\windows\system32> openfiles
ERROR: Unable to retrieve data.
The system could not find the environment option that was entered.

Files opened remotely via local share points:
---------------------------------------------

INFO: No shared open files found.

如果有共享文件正在被访问:

PS C:\windows\system32> openfiles
ERROR: Unable to retrieve data.
The system could not find the environment option that was entered.

Files opened remotely via local share points:
---------------------------------------------

ID       Accessed By          Type       Open File (Path\executable)
======== ==================== ========== =====================================
26843566 Mosser               Windows    D:\..\Testcode\Tools\AMSConsole\
26843569 Mosser               Windows    D:\..\Testcode\Tools\AMSConsole\

通过gridview查看

openfiles /Query /S computerName /FO CSV /V | Out-GridView
本文链接: https://www.pstips.net/powershell-view-opened-files.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!

关于 Mooser Lee

我是一个Powershell的爱好者,创建了PowerShell中文博客,热衷于Powershell技术的搜集和分享。本站部分内容来源于互联网,不足之处敬请谅解,并欢迎您批评指正。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注