Re: How to get the list of open files on network



You can bind to LanmanServer on the local computer:

Set objDC = GetObject("WinNT://MyServer/LanmanServer")

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

"Nir Tal" <NirTal@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:941D1396-6500-4EFA-B7AA-9F93BFAAE0BD@xxxxxxxxxxxxxxxx
how do i do it without a domain ex. a local computer?

"Richard Mueller" wrote:

Nir Tal wrote:

Under computer managment >> shared folders >> sessions or Open files i
can
see whos useing my files.
how can i get this list via Code????

Hi,

The sessions have a tendenancy to come and go, depending on activity, but
you can enumerate them with VBScript code similar to:

Option Explicit
Dim objDC, objSession

Set objDC = GetObject("WinNT://MyDomain/MyServer/LanmanServer")

For Each objSession In objDC.Sessions
Wscript.Echo "Session: " & objSession.Name _
& vbCrLf & " User: " & objSession.User _
& vbCrLf & " Computer: " & objSession.Computer _
& vbCrLf & " Connect Time: " & objSession.ConnectTime _
& vbCrLf & " Idle Time: " & objSession.IdleTime
Next

Set objSession = Nothing
Set objDC = Nothing
Wscript.Echo "Done"

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net





.



Relevant Pages


Loading