Platform SDK: Active Directory, ADSI, and Directory Services

IADsSession

The IADsSession interface is designed to represent an active session for file service across a network. When a remote user opens resources on a targeted machine, an active session is established between the remote user and that machine. Many resources can be opened in a single active session. ADSI represents this process with a session object that implements this interface.

You must call the methods of this interface to examine session-specific information, for example, to see who is using the session, which computer is being used, and the length of time that the user has been logged on for the current session.

Sessions are managed by the file service. Thus, to obtain session objects, you must first bind to this service ("LanmanServer"), as shown in the following code snippet:

Dim fso as IADsFileServiceOperations
Dim ss as IADsCollection
 
Set fso = GetObject("WinNT://myComputer/LanmanServer")
Set ss = fso.Sessions

IADsSession is a dual interface that inherits from IADs. The IADsSession interface exposes the following properties and methods.

Methods in Vtable Order

IUnknown methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments reference count.
Release Decrements reference count.

IDispatch methods Description
GetTypeInfoCount Gets the number of type descriptions.
GetTypeInfo Gets a description of the object's programmable interface.
GetIDsOfNames Maps the name of the method or property to DISPID.
Invoke Calls one of the object's methods, or gets and sets one of its properties.

IADsSession property methods 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 workstation.
get_ComputerPath Gets the ADsPath of the computer object for client workstation.
get_ConnectTime Gets the number of minutes since the session start.
get_IdleTime Gets the number of minutes the session has been idle.

Requirements

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
  Windows 95/98: Requires Windows 95 or later (with DSClient).
  Header: Declared in Iads.h.