I\'m a PowerShell novice (Bash is my thing normally) who\'s currently trying to obtain qwinsta output to show who is logged in as an \'rdpwd\' (rdesktop) user so that I can
Looks like there are a few answers on this but here's another one.
You could extract the substring from each line according to the position like this.
$Sessions=qwinsta.exe
$SessionCount=$Sessions.count
[int]$x=1
do
{$x++
if(($Sessions[$x]) -ne $null){$Sessions[$x].subString(19,21).Trim()}
}until($x -eq $SessionCount)