Jeffrey Snover posted this on the Powershell blog

 

Wei Wu provided a nice one liner in response to a query in our NewsGroup: Microsoft.Public.Windows.PowerShell about how to resolve a hostname into an IP Address:

PS> [System.Net.Dns]::GetHostAddresses("www.msn.com")


IPAddressToString : 207.68.173.76
Address           : 1286423759
AddressFamily     : InterNetwork
ScopeId           :
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : False

 

If you want to go from address to name:

PS> [System.Net.Dns]::GetHostbyAddress("207.46.198.30")

HostName                  Aliases                  AddressList
--------                  -------                  -----------
wwwtkttest2.microsoft.com {}                       {207.46.198.30}

 



Trackbacks

myITforum Newsletters :






myITforum Daily NewsletterDaily NewsletterJune 27, 2006
The myITforum.com newsletter is delivered... Link

Comments

No Comments