IADsFileServiceOperations::Sessions method (iads.h)

The IADsFileServiceOperations::Sessions method gets a pointer to a pointer to the IADsCollection interface on a collection of the session objects that represent the current open sessions for this file service.


HRESULT Sessions(
  [out] IADsCollection **ppSessions


[out] ppSessions

Pointer to a pointer to the IADsCollection interface used to enumerate objects that implement the IADsSession interface and represent the current open sessions for this file service.

Return value

This method supports the standard return values including S_OK. For more information and other return values, see ADSI Error Codes.


Traditional directory services supply data only about directory service elements represented in the underlying data store. Data about sessions for file services may not be available from the underlying store.


The following code example shows how to enumerate active sessions managed by a file service.

Dim fso As IADsFileServiceOperations
On Error GoTo Cleanup

' Bind to a file service operation on "myComputer" 
' in the local domain.
Set fso = GetObject("WinNT://myComputer/LanmanServer")

' Enumerate sessions.
For Each session In fso.sessions
    MsgBox "Session name: " & session.Name
Next session

    If (Err.Number<>0) Then
        MsgBox("An error has occurred. " & Err.Number)
    End If
    Set fso = Nothing

For a code example using the IADsFileServiceOperations::Sessions interface, see the code example given in IADsSession.


Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header iads.h
DLL Activeds.dll

See also