The command "nbtstat -a $LoggedOnTo" returns two 03 entries.
The last one gives the username.
So you must searching for a 03 entry that contains the username and not a another 03 entry who gives the workstation name.
But how to do that?

------------------
http://www.sanderwinkel.com