I'm using this code:
#include <Constants.au3>
Global $DOS, $Message = '' ;; added "= ''" for show only.
$DOS = Run(@ComSpec & " /c tasklist /S server1 /U server1\admin /P password /FI " "USERNAME" & "eq" & @UserName /FI ""IMAGENAME eq notep*""", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
ProcessWaitClose($DOS)
$Message = StdoutRead($DOS)
MsgBox(0, "Stdout Read:", $Message)
But I can't get the syntax right. The tasklist command from the commandline goes like this and works:
tasklist /S server1 /U server1\admin /P password /FI "USERNAME eq user1" /FI "IMAGENAME eq notep*". So everything behind the FI parameter needs quotes. I'm using the @username macro to get the logged on user. But I just can't get the syntax right.