Quote:

tasklist /FI would work, but I dont get the user name on that.




You need the /V flag.

Here is an example using tasklist.exe:

Code:
Break ON
$=SetOption("WrapAtEOL","ON")
For Each $sLine in WshPipe('tasklist /v /FI "imagename eq explorer.exe" /fo CSV /nh')
$aResult=Split($sLine,'","')
If UBound($aResult)>6 "Logged in user='"+$aResult[6]+"'"+@CRLF EndIf
Next

Function WshPipe($ShellCMD)
Dim $oExec, $Output
$oExec = CreateObject("WScript.Shell").Exec($ShellCMD)
If Not VarType($oExec)=9 $WshPipe="WScript.Shell Exec Unsupported" Exit 10 EndIf
$Output = $oExec.StdOut.ReadAll + $oExec.StdErr.ReadAll
$WshPipe=Split(Join(Split($Output,CHR(13)),''),CHR(10))
Exit($oExec.ExitCode)
EndFunction