Tuesday, 5 October 2010

Get-HostByName.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     This script gets and displays basic DNS Information about a host. 
  4. .DESCRIPTION 
  5.     This script just gets and displays host details returnd by GetHostByName. 
  6. .NOTES 
  7.     File Name  : Get-ByName.ps1 
  8.     Author     : Thomas Lee - tfl@psp.co.uk 
  9.     Requires   : PowerShell Version 2.0 
  10. .LINK 
  11.     This script posted to: 
  12.         http://www.pshscripts.blogspot.com 
  13.     MSDN sample posted tot: 
  14.         http://msdn.microsoft.com/en-us/library/system.net.dns.aspx 
  15. .EXAMPLE 
  16.     PSH [C:\foo]: .\Get-HostByName.ps1 
  17.  
  18.     HostName    : contoso.com 
  19.     Aliases     : {www.contoso.com} 
  20.     AddressList : {207.46.197.32, 207.46.232.182} 
  21. #> 
  22. $hostInfo = [system.net.Dns]::GetHostByName("www.contoso.com"); 
  23. $hostinfo | fl * -force 

No comments: