Directory Services

IADsSession

The IADsSession interface is a dual interface that inherits from IADs. It is designed to represent an active session for file service across a network.

Methods in Vtable Order

The IADsSession interface inherits the methods of the standard COM interfaces:

In addition, IADsSession defines the following methods.

Method Description
get_User Gets the name of user for the session.
get_UserPath Gets the ADsPath of the user object.
get_Computer Gets the name of the client computer.
get_ComputerPath Gets the ADsPath of the computer object for client computer.
get_ConnectTime Gets the number of minutes elapsed since the session start.
get_IdleTime Gets the number of minutes that the session has been idle.

Properties

The IADsSession interface defines the following properties. The preceding table includes access methods for these properties.

Property Description
Computer Gets the name of the client computer.
ComputerPath Gets the ADsPath of the computer object for client computer.
ConnectTime Gets the number of minutes elapsed since the session start.
IdleTime Gets the number of minutes that the session has been idle.
User Gets the name of user for the session.
UserPath Gets the ADsPath of the user object.

Remarks

When a remote user opens resources on a target computer, an active session is established between the remote user and that computer. Many resources can be opened in a single active session. ADSI represents this process with a session object that implements this interface.

Call the methods of this interface to examine session-specific data, for example, who is using the session, which computer is used, and the time elapsed for the current session.

Sessions are managed by the file service. To obtain session objects, first bind to this service ("LanmanServer" or "FPNW").

Example Code [Visual Basic]

The following code example shows how to bind to a session.

Dim fso as IADsFileServiceOperations
Dim ss as IADsCollection

On Error GoTo Cleanup
 
Set fso = GetObject("WinNT://myComputer/LanmanServer")
Set ss = fso.Sessions

' Insert code to access session data.

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

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.