Page 1 of 2
Find who has a shared file open on network
Posted: Thu Oct 25, 2018 10:07 pm
by Jamal
Hi,
I wonder if anyone created a function (C#, VO or X#) to find out which workstation or user has a shared file open on local area network.
The issue arises when I need to index DBF files, then admin has to go to every workstation and see which has the program open and close all windows or exit the program.
Thanks,
Jamal
Find who has a shared file open on network
Posted: Fri Oct 26, 2018 5:34 am
by SHirsch
Hi Jamal,
not exactly what you are looking for:
I have the very same problem. Indexing DBFs or updating the app requires closing all running instances.
I create a little file with a fix filename (_CLOSE_ALL_.xxx). The apps are polling once a minute for this file. If it exists the app closes itself. Maybe this approach can help in the future.
Stefan
Find who has a shared file open on network
Posted: Fri Oct 26, 2018 5:46 am
by wriedmann
Hi Jamal,
the administrator can look on the server who has a file open, and close it when neccessary.
In my programs, I have implemented a setting. If it is set, all clients close down itself. This works very well.
Wolfgang
Find who has a shared file open on network
Posted: Fri Oct 26, 2018 4:22 pm
by Jamal
Hi Stefan and Wolfgang,
I was thinking about implementing a timer that sends a message to workstations to close down in a couple of minutes after a warning is display of an imminent shutdown. However, sometimes a file may get "stuck" open (due to a possible crash) and it be would great to know which station has the file still open.
Jamal
Find who has a shared file open on network
Posted: Fri Oct 26, 2018 4:24 pm
by Jamal
Hi Wolfgang,
>> the administrator can look on the server who has a file open, and close it when necessary. >>
Which tool is used to see that info? Let say on Windows Server 2012 or 2016.
Jamal
Find who has a shared file open on network
Posted: Fri Oct 26, 2018 4:37 pm
by wriedmann
Hi Jamal,
I have only a German version to look.
In the System Managment applet there is a choice called "Shared Folders", and then "Open Files".
Wolfgang
Find who has a shared file open on network
Posted: Fri Oct 26, 2018 9:13 pm
by Jamal
Thanks Wolfgang, will check it out.
Find who has a shared file open on network
Posted: Mon Oct 29, 2018 6:45 pm
by g.bunzel@domonet.de
Jamal,
you can also use the Windwos API NetFileEnum to get some or all open files.
https://docs.microsoft.com/en-us/window ... etfileenum
HTH
Gerhard
Find who has a shared file open on network
Posted: Tue Oct 30, 2018 11:38 am
by Karl-Heinz
Hi Jamal,
the attached zip contains a very old aef of mine that uses NetFileEnum() to show opened files in a listview. The app worked at least with a w2k Server.
I only made some minor changes ( adding missing return values etc. ) to compile the aef with VO 2.8. Currently it seems , though NetFileEnum() returns NERR_Success, that the params @dwEntriesread, @dwTotalentries are always 0. I do not have the time to take a closer look, but maybe you or someone else can make it work again ?
regards
Karl-Heinz
Find who has a shared file open on network
Posted: Tue Oct 30, 2018 11:48 am
by wriedmann
Hi Karl-Heinz,
according to the Microsoft documentation this works only if the current user has domain administrator rights or server administrator rights.
I have no server at customers sites where a local workstation user has these rights.
Wolfgang