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:

Anonymous said...

Awesome! Thanks!

fbazsa said...

Hello!

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

thanks in advance,
Balazs

Stanley Sawyer said...

Great posst