Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to find out computer name by ip on LAN? I know an the ip address of a computer in question but how do I get its workgroup name?

share|improve this question
add comment

3 Answers

up vote 0 down vote accepted

Please find the below function which will get both the IP and name of the computer. Change your range for the IP.

It will ping each IP and find out the response.

Public Function mCheckThroughWMIQuery() As String
   Dim oWMI = GetObject("winmgmts:")
   Dim IP = GetObject("winmgmts:")
   Dim oPings = GetObject("winmgmts:")
   Dim PcName = GetObject("winmgmts:")
   Dim sResult As String = ""
   For i = 70 To 100
       IP = "192.168.1." + i.ToString
       oPings = oWMI.ExecQuery("Select * from WIN32_Pingstatus where address='" + IP + "'" + " and ResponseTime > 0")

       For Each oPing In oPings
           Try
               PcName = System.Net.Dns.GetHostEntry(IP)
               sResult &= IP & Chr(9) & PcName.HostName & vbNewLine
           Catch ex As Exception
               sResult &= IP & vbNewLine
           End Try
       Next
   Next
   Return sResult
End Function
share|improve this answer
add comment

Try using the command nbtstat -a [ip address] in the command prompt:

win+r then type cmd and then press enter.

This should display a table of names. The name associated with the type "Unique" is the name of the computer. The name associated with the type "Group" should be the workgroup the computer is joined on.

share|improve this answer
add comment

The kitchen sink answer is to just run nmap against the IP.

That'll get you just about all the information it's possible to acquire from probing the computers network interface.

While it's a bit overkill here, nmap (and the GUI included - zenmap) are tremendously usefull in and of themselves.

share|improve this answer
    
Thank you very much. That solved my problem. Nice forum) –  Nickolodeon Jan 15 '11 at 1:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.