• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3128
  • Last Modified:

List open files in a shared folder

I want to list all of the open files in a shared folder, if you go to computer management > Shard Folders > Open Files, you can see the list I am talking about.

I am aware that I could open a command prompt and run the command Net Files but I was wondering if there was a way to query this list without going through the command prompt.  I have been trying to use WMI queries but I cannot figure out how to have it list the path of the open file.
Any help would be appreciated.

  • 2
1 Solution
SZachmannAuthor Commented:
wmeerza, that's for that post, that will do what I was looking for but I was hoping there was a way to find this information using the .net framework and not having to create com objects.   Do you know of such away?
I will be honest, i'm not sure.
You might find this snippet of code useful, it is one method i use that allows wildcard searching (for part of filename or foldername) and puts the result in Excel. Just paste it into a vbs and change 'yourservername' to match your fileserver, double click it and type your filename.
Hope this helps.
On Error Resume Next
Dim fso
Dim FindPos, Input
Dim RowNumber, ColumnNumber, XL
Input = InputBox("Enter any part of Filename","Case Insensitive")
Set XL = CreateObject("Excel.Application")
XL.Visible = TRUE
XL.Cells(RowNumber, ColumnNumber).Value = "User"
XL.Cells(RowNumber, ColumnNumber+1).Value = "Path"
'  Bind to a file service operations object on servername" in the local domain.
Set fso = GetObject("WinNT://yourserver/LanmanServer")
' Enumerate resources
If (IsEmpty(fso) = False) Then
For Each resource In fso.resources
If (Not resource.User = "") And (Not Right(resource.User,1) = "$") Then
FindPos = Instr(1, resource.path, Input ,1)
If (FindPos <> 0) Then
XL.Cells(RowNumber, ColumnNumber).Value = resource.user
XL.Cells(RowNumber, ColumnNumber+1).Value = resource.Path
End if
End If
End If
Set XL=nothing
MsgBox "Done"

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now