I am trying to pipe the results from this Terminal Server command to a variable I can use in my Kix script.

Code:

$Myarray = Split("%SystemRoot%\Profiles\operez","\")
$x = UBOUND($MyArray)
$UserName = $MyArray[$x]
Shell '%comspec% /c tsprof /q /domain:frost_bank $UserName' >$file
? "Results from $file"




Am I doing it wrong?