none
Script to query DHCP server for computer name if IP address is known RRS feed

  • Question

  • I run vulnerability scans of my company’s network. After scanning my network I have a lists of IP addresses with no computer names. Most of them appear to be VTC or telephony systems so they are don’t respond to NBTSTAT. I can manually
    find them in my DHCP server but the lists is quite long. Does anyone know of a script that I can run against the IP address lists that would query the DHCP server and return the associated machine name that is listed in the DHCP server? 
    Monday, August 11, 2014 7:18 PM

Answers

  • Use DNS it is easier.

    [System.Net.DNS]::GetHostByAddress('192.168.1.102')


    ¯\_(ツ)_/¯

    • Proposed as answer by jrv Monday, August 11, 2014 7:59 PM
    • Marked as answer by Bill_StewartModerator Sunday, September 7, 2014 2:30 PM
    Monday, August 11, 2014 7:59 PM
  • Surely you have a DNS server and this is all set up and you're not relying on NetBIOS broadcasts or a WINS server?

    PowerShell:


    ([Net.Dns]::GetHostByAddress("123.123.123.123")).HostName
    


    -- Bill Stewart [Bill_Stewart]

    Monday, August 11, 2014 8:01 PM
    Moderator

All replies

  • Use DNS it is easier.

    [System.Net.DNS]::GetHostByAddress('192.168.1.102')


    ¯\_(ツ)_/¯

    • Proposed as answer by jrv Monday, August 11, 2014 7:59 PM
    • Marked as answer by Bill_StewartModerator Sunday, September 7, 2014 2:30 PM
    Monday, August 11, 2014 7:59 PM
  • Surely you have a DNS server and this is all set up and you're not relying on NetBIOS broadcasts or a WINS server?

    PowerShell:


    ([Net.Dns]::GetHostByAddress("123.123.123.123")).HostName
    


    -- Bill Stewart [Bill_Stewart]

    Monday, August 11, 2014 8:01 PM
    Moderator