Have you ever gotten a call asking who has file “x” open and why it’s locked? There’s a few scripts out there on the net that tackle this issue, but I thought I would give my own take on the common get-openfiles function. Below is the code I’ve written for this purpose.

Some of the improvements I made are as follows:

  • Can be run against multiple file servers in one shot.
  • Outputs object data that can be re-used in the pipeline
  • Pre-built with some help data
  • If a file server cannot be queried, the script will not crash, but return empty hash tables instead. This can be useful if you have a long list of file servers to query.

The tools being developed on this blog are available on the PowerShell gallery here! This means to begin using the tool set, simply run the following command to install them.

Install-Module -Name ServerAdminCommon

If you have previously installed the toolset, you can update the tools using following command:

Update-Module -Name ServerAdminCommon

As with all of the modules on this blog, you can find this tool on my github page for the ServerAdminCommon tool set.


Disclaimer: All scripts and other powershell references on this blog are offered “as is” with no warranty. While these scripts are tested and working in my environment, it is recommended that you test these scripts in a test environment before using in your production environment.