Friday 26 July 2019

windows 7 - Remotely close open shared files


I have a Windows 7 computer that is hosting some files in my network. Sometimes a file (usually an Office document) is stuck in the open state even after a user has finished editing it. What I do to resolve this is to go to Computer Management > Shared Folders > Open Files and close the connection to the culprit file.


However, I always have to do this by remote controlling the host computer. Is there a faster way to accomplish this? I'm open to anything that can help me speed up the process (batch, powershell, remote MMC, etc).


What I've Tried:


I've tried using Remote MMC from my workstation into the host, but when I try to open System Tools > Shared Folders > Open Files I get error You do not have permissions to see the list of files opened by Windows clients.


Edit:


While remote commands are great, and I'd be open to using them, I need a way to both list the files, identify which one I need closed, and close it in relatively the same amount of time that it would take to use the MMC snap-in to do it through the GUI.



Answer



From this TechNet article :


To close an open shared file or folder by using the Windows interface:



  1. Open Computer Management.

  2. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Yes.

  3. Go under the Action menu and click Connect to another computer . . .

  4. In the console tree, click System Tools, click Shared Folders, and then click Open Files.

  5. Do one of the following:


  6. To close all open files and folders, on the Action menu, click Disconnect All Open Files.




  7. To close a specific file or folder, in the Results pane right-click the file or folder name, and then click Close Open File.




  8. To disconnect multiple open files or folders, press the CTRL key while clicking the file or folder names, right-click any one of the selected files or folders, and then click Close Open File. This closes the selected files or folders.




To close an open shared file or folder by using a command line



  1. To open an elevated Command Prompt window, click Start, point to All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.

  2. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Yes.

  3. Type:


net file /close


For example, to close an open file identified as myfile_id, type:


net file myfile_id /close


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...