Here is a short reusable function that came about when I recently had an error popup with just an IP address.
Turned out it was error many users were getting that caused a problem in the company. From the IP address I wanted to get the Hostname to ask the Wintel department if they knew of this Server. I could have simply used the “Ping” command with a ‘-a’ option, but I wanted to find a way in PowerShell and create a function as a simply to use tool. As I was creating a function to find a Hostname from an IP why not do the reverse as well and get the IP from a Hostname. This is what I did, and by using the .NET class, “system.net.dns”, was able to achieve this. I hope you find it of some use in your day to day troubleshooting !
Get-NetDetails -HostName lhr25s01-in-f4.1e100.net Get-NetDetails -IP 184.108.40.206