Skip to main content

1E SDK

Users.GetPrimaryUser

Module

Users

Method

GetPrimaryUser

Library

Core

Action

Get the primary user of a device.

Parameters

(None)

Return values

PrimaryUser (string): The name of the primary user of a device.

  • Windows: If historic data is available (requires Inventory module to be enabled) - the user with the longest total logged-on duration over the last 28 days. From v23.7 onwards this is the user with the highest total InteractionMinutes in the $DeviceInteraction_Daily_Raw table, and if gives no result then falling back to the user with the highest total Duration in the $UserUsage_Daily table. Prior to v23.7 only the $UserUsage_Daily table was used.

    Without historic data - whoever has been logged-in longest of all the active users.

  • macOS and Linux : If historic data is available - the user with the longest total logged-on duration over the last 28 days. Without historic data - the user with the most number of active sessions.

Active means currently logged on.

Example

Users.GetPrimaryUser();

Platforms

  • Windows

  • Linux

  • MacOS

Notes

The following is ignored:

  • Service accounts on Windows

  • Daemon usage on non-Windows

Root logins are not ignored.

More detail about active (currently logged-on) users is available using Users.GetLoggedOnUsers.

For Windows, historic data is also stored in the Tachyon Activity Record: User usage daily table if the Inventory module is enabled.

The 28-day threshold used to analyze historical data is not configurable in this version of Tachyon.