I want to make a script that closes open files in our storage.
I can do it with compmgmt.msc
, connecting to the storage as a remote computer, then I go to "System Tools" --> "Shared Folders" --> "Open Files".
Is there a Command-line interface for Computer Managment MMC?
The
openfiles
command line works in the same way. You can use it without argument to get a list of open files (sadly, the tool is hard-coded to truncate the output so it might be a bit touch and go if you have long file path).You can then use the
openfiles /disconnect (file)
command to disconnect a specific file.Edit: you can do better with powershell.