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.
In reply to Re: Query current logged in Windows user via WMI
by VinsWorldcom
in thread Query current logged in Windows user via WMI
by wveagle81
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |