Getting the id of the current user isn't exactly straight forward. Using SIDTONAME in Kix 2001 B2 can do it probably the simplist.

My logon script records the time, date, userid and sid to an INI file at logon time. If I want to know who is loggedon to a remote PC I just read the time and date and userid from the log file.

Otherwise you can resort to using Sysinternals "Loggedon.exe" tool. It is a bit clunky and you can't really use the out put reliably, in a script. But for a once in a while query it works just fine.