Wednesday, August 4, 2010

Get alias cname hostname DNS using powershell

Well, just a way in powershell to know real hostname alias (CNAME)


$computername = [System.Net.Dns]::GetHostByName("youralias")
Write-Host $computername.HostName.substring(0,$computername.HostName.IndexOf("."))

3 comments:

  1. Awesome! Thanks!

    ReplyDelete
  2. Hello!

    Could you help?
    I would need the cname (alias) from the hostname.
    Is it possible?

    thanks in advance,
    Balazs

    ReplyDelete