How to use powershell to resolve IP address to hos

2019-08-07 10:07发布

We have both Windows servers and Linux servers in the domain, and I would need to find the hostname based on ip address.

Currently I am using [System.Net.Dns]::gethostentry('10.254.254.254').HostName to get the hostname. But this only work when target machine is windows machine. When the target machine is Linux machine, this powershell script doesn't work.

Can someone please help to advise how to use powershell to resolve IP address to hostname for Linux machine?

Thanks!

1条回答
Evening l夕情丶
2楼-- · 2019-08-07 10:28

Upgrade your PS version to 5.1.

I am running 5.1.14409.1005 on Win Srv 2012 and it works for both Unix and Windows.

查看更多
登录 后发表回答