How to use powershell to resolve IP address to hostname for Linux

坚强是说给别人听的谎言 提交于 2019-12-24 07:39:19

问题


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:


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.



来源:https://stackoverflow.com/questions/42014215/how-to-use-powershell-to-resolve-ip-address-to-hostname-for-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!