$strComputer = "." $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colSessions = $objWMIService.ExecQuery("Select * from Win32_LogonSession Where LogonType=2 or LogonType=10") For $objSession in $colSessions $colList = $objWMIService.ExecQuery("Associators of {Win32_LogonSession.LogonId=" & $objSession.LogonId & "} Where AssocClass=Win32_LoggedOnUser Role=Dependent") For $objItem in $colList If @UserName = $objItem.Name Then ; do something interactively Else ; do non-interactive tasks EndIf Next Next
I can't help but think this might not be all that hard to implement in Autoit3 as a macro, such as a @LogonType that matches the Win32_LogonSession.LogonType values, or even just a simpler, boolean @LogonInteractive or something. I'm sure it would be much quicker than WMI also.
If there's already a feature like this in AutoIt3, please let me know.
Thoughts?




This topic is locked
