BTW...

more functions used to provide equivalent results...



break on

$w=WinsResolve('username')
$l=lookup($w)

$w
$l

Function WinsResolve($username,optional $winsserver)
    dim $winsserver$ipconfig$line$wins1$wins2$file$WINSarray$ip
    if not $winsserver
        $return=WSHPipe('%comspec% /c ipconfig /all| find "Primary WINS Server"',1)[0]
        if instr($return,"Primary WINS Server")
            $WinsServer=trim(split($return,':')[1])
            endif
        endif
    if not $winsserver    exit 1        return        endif

    $file='c:\winscl.txt'
    del $file
    $parameters="$WINSserver","QN",$username,"1","03","0","EX"
    $X = open (1"$file"5)
    for each $param in $parameters
        $X = writeline(1$param + @CRLF)
        next
    $X = Close(1)

    $WINSarray=WshPipe("%comspec% /c winscl.exe T NOME< $file",1)
    del $file
    for each $line in $WinsArray
        if instr($line,'Address is (')
            $IP = split(split($line,'(')[1],')')[0]
                  endif
        next
    if $ip
        $WinsResolve='$ip'
    else 
        exit 1
        return
        endif
    endfunction

Function Lookup($ip)
    Dim $return
    $return=WSHPipe('%comspec% /c nslookup $ip | find "Name:"',1)[0]
    if instr($return,"Name:")
        $lookup=trim(split($return,':')[1])
    else
        exit 1
        $lookup=""
        endif
    endfunction

Function WshPipe($ShellCMDOPTIONAL $NoEcho)
   Dim $WshShell$oExec$AllOutput$Exit$WshExitCode
   $WshErrorMsg=""
   $WshShell=CreateObject("WScript.Shell")
   $oExec=$WshShell.Exec($ShellCMD)
   While $Exit<>1
      Dim $Output
      Select
      Case Not $oExec.StdOut.AtEndOfStream         $Output=$oExec.StdOut.ReadAll
      Case Not $oExec.StdErr.AtEndOfStream         $Output=$oExec.StdErr.ReadAll
                           $WshErrorMsg = $Output
      Case 1                       $Output=-1
      EndSelect
      If $Output=-1
         If $oExec.Status=1
            $Exit=1
         Endif
      Else
         If $NoEcho<>1
            ? $Output
         Endif
         $AllOutput = $AllOutput + $Output
      Endif
   Loop
   $WshExitCode=$oExec.ExitCode
   $WshPipe=split($AllOutput,chr(10))
   Exit($WshExitCode)
EndFunction

_________________________
How to ask questions the smart way <-----------> Before you ask