# encoding: ascii
# api: powershell
# title: Get-DCsFromDNS
# description: A function that allows me to query DNS on my internal servers for Domain Controllers
# version: 0.1
# type: function
# license: CC0
# function: Get-DCsFromDNS
# x-poshcode-id: 2042
# x-archived: 2010-08-06T18:07:53
#
#
function Get-DCsFromDNS($DomainName){    
$DCs = get-dns _ldap._tcp.dc._msdcs.$DomainName -Type srv | select -ExpandProperty RecordsRR | 
 %{$_.record.target} | select -Unique | sort | %{
get-dns $_ | select -ExpandProperty Answers | select Name,@{n='IPAddress';e={$_.Record}}}
return $DCs
}
