DC's in daom by IP and Name

Easy one, I know there must be a fast way to pull all the DC's in my domain (children also pls) and their IP's.  It must be in DNS, and an adsi command or something.
LVL 11
loftywormAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
$DCS = Get-ADComputer -Filter * -SearchBase "OU=Domain Controllers,DC=corp,DC=Example,DC=com" 
foreach ($DC in $DCS){
Resolve-DnsName -Name $dc.Name -Type A | Select Name,IPAddress
}

Open in new window

0
loftywormAuthor Commented:
TY, you will get some point for certain, but here is another crux.
All the DC's may not be in that OU.  I strongly suspect I will have to pull the information from DNS (not all have NS records though, by design) or Sites and Services.
0
Aaron TomoskySD-WAN SimplifiedCommented:
modifying davids command to pull domain controllers instead of computers filtered to an ou. I don't have a forest to test this on though, it might do the same thing, but at least you don't have to fill in the searchbase

$DCS = Get-ADDomainController -Filter *
foreach ($DC in $DCS){
Resolve-DnsName -Name $dc.Name -Type A | Select Name,IPAddress
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

loftywormAuthor Commented:
very VERY nice :)
Saved me BUNCHS of work :)

Thank you both so much, wish I could give out more then 500 points!
0
loftywormAuthor Commented:
Very nice, :)
0
loftywormAuthor Commented:
ok, this is awesome, but one last question.
On my 2008 DC's in my other domain's, the resolve-dns command is not present.  So
How do I add it?
or
How do I change the domain request from the DC that I have that works?
0
Aaron TomoskySD-WAN SimplifiedCommented:
I don't have an 08 to test on, but you can install newer powershell if you want
http://www.microsoft.com/en-us/download/details.aspx?id=34595

this is the command for powershell 2.0
[Net.DNS]::GetHostEntry("MachineName")

so to integrate it back into the script, but I can't test it so I'm not sure the syntax is correct:
$DCS = Get-ADDomainController -Filter *
foreach ($DC in $DCS){
[Net.DNS]::GetHostEntry("$dc.Name")
}

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.