Skip to main content

Get-LoggedOnUser

SYNOPSISโ€‹

Get session details for all local and RDP logged on users.

SYNTAXโ€‹

Get-LoggedOnUser [<CommonParameters>]

DESCRIPTIONโ€‹

Get session details for all local and RDP logged on users using Win32 APIs. Get the following session details: NTAccount, SID, UserName, DomainName, SessionId, SessionName, ConnectState, IsCurrentSession, IsConsoleSession, IsUserSession, IsActiveUserSession IsRdpSession, IsLocalAdmin, LogonTime, IdleTime, DisconnectTime, ClientName, ClientProtocolType, ClientDirectory, ClientBuildNumber

EXAMPLESโ€‹

EXAMPLE 1โ€‹

Get-LoggedOnUser

PARAMETERSโ€‹

CommonParametersโ€‹

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTSโ€‹

Noneโ€‹

You cannot pipe objects to this function.โ€‹

OUTPUTSโ€‹

Noneโ€‹

This function does not return any objects.โ€‹

NOTESโ€‹

Description of ConnectState property:

Value Description


Active A user is logged on to the session. ConnectQuery The session is in the process of connecting to a client. Connected A client is connected to the session. Disconnected The session is active, but the client has disconnected from it. Down The session is down due to an error. Idle The session is waiting for a client to connect. Initializing The session is initializing. Listening The session is listening for connections. Reset The session is being reset. Shadowing This session is shadowing another session.

Description of IsActiveUserSession property:

  • If a console user exists, then that will be the active user session.
  • If no console user exists but users are logged in, such as on terminal servers, then the first logged-in non-console user that has ConnectState either 'Active' or 'Connected' is the active user.

Description of IsRdpSession property:

  • Gets a value indicating whether the user is associated with an RDP client session.

Description of IsLocalAdmin property:

  • Checks whether the user is a member of the Administrators group

https://psappdeploytoolkit.com