This is how I do it in my helpdesk app:
 Code:
; get the currently logged-on user, if any
      If $SECURE $WMIOBJPTR = WMIAuthentication($txtHost.Text, $USERID , $USERPW) EndIf
      $RC = ''
      $ACTIVEUSERID = WMIQuery('UserName', 'Win32_ComputerSystem', $txtHost.Text, , , , $WMIOBJPTR)[0]
      If InStr($ACTIVEUSERID, '\') $RC = Split($ACTIVEUSERID, '\')[1] Else $RC = $ACTIVEUSERID EndIf
The two WMIxxxxx functions are available from the resources page of my website, and just slightly modified/updated versions of those posted on KORG. The above example was developed on XP and works on Vista/Win7.

$WMIOBJPTR can be null/eliminated unless you need a specific account to authenticate against the remote machine. WMIAuthentication() simply provides a standard function to get an authenticated WMI object rather than building it into every WMI function.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D