Returns information about logon sessions associated with the user currently logged on to a computer.

This script was tested using Object REXX 2.1.0 for Microsoft Windows, available from IBM.

Object REXX
Edit|Remove
strComputer = "."
objWMIService = .OLEObject~GetObject("winmgmts:\\"||strComputer||"\root\CIMV2")
do objItem over objWMIService~ExecQuery("Select * from Win32_LogonSession")
    say "Authentication Package:" objItem~AuthenticationPackage
    say "Caption:" objItem~Caption
    say "Description:" objItem~Description
    say "Install Date:" objItem~InstallDate
    say "Logon Id:" objItem~LogonId
    say "Logon Type:" objItem~LogonType
    say "Name:" objItem~Name
    say "Start Time:" objItem~StartTime
    say "Status:" objItem~Status
end