Function to find a username by IP

Found Here


Private Function NBTStatInfo(ByVal ip As String) As String 
        Dim p As Process 
        Dim cmd As String 
        Try 
            p = New Process 
            cmd = System.Environment.GetFolderPath(Environment.SpecialFolder.System) & "\cmd.exe" 
            p.StartInfo.FileName = cmd 
            p.StartInfo.Arguments = "/C nbtstat -A " & ip 
            p.StartInfo.RedirectStandardOutput = True 
            p.StartInfo.UseShellExecute = False 
            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden 
            p.Start() 
            p.WaitForExit(1000) 
            Return p.StandardOutput.ReadToEnd 
        Catch ex As Exception 
            Debug.WriteLine(ex.ToString) 
            Return Nothing 
        Finally 
            If Not p Is Nothing Then 
                p.Dispose() 
                p = Nothing 
            End If 
        End Try 
    End Function