Skip to main content

1E 8.1 (on-premises)

Users.GetLoggedOnUsers

Method

GetLoggedOnUsers

Module

Users

Library

Core

Action

List the active (currently logged-on) user sessions.

Parameters

(None)

Return values

For each session:

  • Account (string): User name.

  • SessionId (string): Session ID.

  • SessionName (string): Session Name.

  • LogonTime (string): Logon time of the session. Only available for Windows Vista SP1 and later.

  • SessionState (string): The session state as defined by the WTS_CONNECTSTATE_CLASS enum. MS Windows hosts only.

  • RemoteSession (boolean): Whether or not the session is a remote session

  • RemoteIp (string): IP address of the client if the connection is remote (otherwise empty). Not available on Solaris.

  • RemoteName (string): Hostname of the client if the connection is remote (otherwise empty). On MacOS only the IP address is available.

Example

@users = Users.GetLoggedOnUsers();
//get the home drive/path for each logged on user by running a command as each of them
@home =
    FOREACH @user IN @users DO
        NativeServices.RunCommand(CommandLine:"CMD /c ECHO %HOMEDRIVE%%HOMEPATH%",AsUser:@user.Account);
        SELECT usr.*, cmd.Output AS Home FROM @user usr, @@last cmd;
    DONE;

Platforms

  • Windows

  • Linux

  • MacOS

  • Solaris Intel

  • Solaris Sparc

  • Android

Notes

Although this method is provided for Android it usually does not return any data for Android Oreo (v8.0 and later). In these later version of Android such accounts must be explicitly granted visibility to the Tachyon Agent. This does not usually happen, in which case no data is returned.