?

Log in

No account? Create an account

Previous Entry | Next Entry

PowerShell IP/Hostname conversion

Convert name to IP address
[System.Net.Dns]::GetHostAddresses("www.msn.com")

Only want the IP address?
[System.Net.Dns]::GetHostAddresses("www.msn.com") | select-object IPAddressToString

Convert IP address to name
[System.Net.Dns]::GetHostbyAddress("207.46.198.30")

Only want the host name?
[System.Net.Dns]::GetHostbyAddress("207.46.198.30") | select-object HostName

Tags: