Find who has a shared file open on network

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Find who has a shared file open on network

Post 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
User avatar
SHirsch
Posts: 286
Joined: Tue Jan 30, 2018 8:23 am
Location: Germany

Find who has a shared file open on network

Post 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
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Find who has a shared file open on network

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Find who has a shared file open on network

Post 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
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Find who has a shared file open on network

Post 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
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Find who has a shared file open on network

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Find who has a shared file open on network

Post by Jamal »

Thanks Wolfgang, will check it out.
g.bunzel@domonet.de
Posts: 97
Joined: Tue Mar 01, 2016 11:50 am
Location: Germany

Find who has a shared file open on network

Post 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
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Find who has a shared file open on network

Post 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
Attachments
AppEnum.zip
(12.58 KiB) Downloaded 103 times
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Find who has a shared file open on network

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply