WEB LISTING 1: ObtainCompNames.vbs Option Explicit Dim objShell, objExec, strUserName, strOutput, intLine Dim intPosition, strIP, arrEntrySplit, strComputerName, intRemote Set objShell = CreateObject("WScript.Shell") strUserName = InputBox("Please enter a user name:" & vbCRLF & vbCRLF & _ "(Press [ENTER] or click [CANCEL] to exit...)", _ "User Computer Name Locator", "") Do While strUserName <> "" Set objExec = objShell.Exec("NETSH WINS SERVER \\WinsServerName SHOW NAME " _ & strUserName & " 03") For intLine = 1 To 4 objExec.StdOut.ReadLine Next If objExec.StdOut.ReadLine <> "The name does not exist in the WINS database." Then For intLine = 1 To 5 objExec.StdOut.ReadLine Next strOutput = objExec.StdOut.ReadLine If Left(strOutput,10) <> "IP Address" Then strOutput = objExec.StdOut.ReadLine End If intPosition = InStr(strOutput, ":") strIP = Right(strOutput, (Len(strOutput) - intPosition) - 1) Set objExec = objShell.Exec("NBTSTAT -A " & strIP) Do While Not objExec.StdOut.AtEndOfStream strOutput = objExec.StdOut.ReadLine If InStr(strOutput,"<03>") <> 0 Then arrEntrySplit = Split(strOutput) If UCase(arrEntrySplit(4)) <> UCase(strUserName) And _ UCase(arrEntrySplit(4)) <> UCase(strComputerName) And _ UCase(arrEntrySplit(4)) <> strComputerName & "$" Then strComputerName = strComputerName & UCase(arrEntrySplit(4)) End If End If Loop If strComputerName <> "" Then MsgBox "The requested user '" & strUserName & _ "' is logged on to: " & strComputerName,,"User Computer Name Locator" Else MsgBox "The requested user '" & strUserName & _ "' doesn't appear to logged on to the network. " End If Else MsgBox "The user was not found in the WINS database. ",, _ "User Computer Name Locator" End If strComputerName = "" strUserName = InputBox("Please enter a user name:" & vbCRLF & vbCRLF & _ "(Press [ENTER] or click [CANCEL] to exit...)", _ "User Computer Name Locator", "") Loop