in reply to Query current logged in Windows user via WMI
You mentioned Win32::OLE but also mention "WMI" in your title. If you're using an external program, how about 'query':
VinsWorldcom@C:\Users\VinsWorldcom> which query C:\Windows\system32\query.exe VinsWorldcom@C:\Users\VinsWorldcom> query /? QUERY { PROCESS | SESSION | TERMSERVER | USER } VinsWorldcom@C:\Users\VinsWorldcom> query user /? Display information about users logged on to the system. QUERY USER [username | sessionname | sessionid] [/SERVER:servername] username Identifies the username. sessionname Identifies the session named sessionname. sessionid Identifies the session with ID sessionid. /SERVER:servername The server to be queried (default is current). VinsWorldcom@C:\Users\VinsWorldcom> query user USERNAME SESSIONNAME ID STATE IDLE TIME LOGON + TIME >VinsWorldcom console 1 Active none 5/21/ +2013 7:03 PM
Not sure if the 'query' command functionality is in Win32::OLE.
Also note that the command 'net user USERNAME' returns the last logon time, but it is reset even if the user locks the screen and then unlocks it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Query current logged in Windows user via WMI
by VinsWorldcom (Prior) on Jun 04, 2013 at 20:10 UTC | |
|
Re^2: Query current logged in Windows user via WMI
by wveagle81 (Novice) on Jun 04, 2013 at 19:54 UTC |