List open files in a shared folder

Experts
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.

Thanks!
LVL 2
SZachmannAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wmeerzaCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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?
0
wmeerzaCommented:
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
 
ColumnNumber=1
RowNumber=1
 
Input = InputBox("Enter any part of Filename","Case Insensitive")
 
Set XL = CreateObject("Excel.Application")
XL.workbooks.add
XL.Visible = TRUE
 
XL.Cells(RowNumber, ColumnNumber).Value = "User"
XL.Cells(RowNumber, ColumnNumber+1).Value = "Path"
RowNumber=RowNumber+1
 
'  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
RowNumber=RowNumber+1
End if
End If
 
Next
End If
XL.Cells.EntireColumn.Autofit
Set XL=nothing
MsgBox "Done"

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.