Query to find all windows 2008 domain controllers

Simon336697
Simon336697 used Ask the Experts™
on
Dear all,
Hope you are all well and can assist.
Guys we have 2003 and 2008 domain controllers.
I would like to build a dsquery or saved query to find all 2008 domain controllers.
Any help greatly appreciated.
Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
dsquery server -forest
Top Expert 2013
Commented:
So your DCs should be in your domain controllers OU.  The 2008 DCs will have operatingsystem=*2008*

I've included the first two screenshots from a saved query.  In screen one you will see I changed it to the domain controllers OU then in screen 2 the query

operatingsystem=*2008*

1
2
Thanks

Mike
Senior Active Directory Engineer
Top Expert 2012
Commented:
Hi,

the most simple one is to use:

dsquery server -name * -limit 0 | dsget server -dnsname -site -isgc

Open in new window


or using nltest command:

nlteste /dclist:<dns-domain-name>

Open in new window


EDIT: oh, sorry I missed that it is for 2008 DCs only :) So, use Mike's suggestion or run this query

dsquery * -filter "(&(objectClass=Computer)(objectCategory=Computer)(userAccountControl:1.2.840.113556.1.4.803:=8192)(operatingSystem=*2008*))" -attr name operatingSystem operatingSystemServicePack >>c:\dcs2008.txt

Open in new window


Regards,
Krzysztof
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Guys thanks so much for your kind expert help.
No problem.
Krzysztof PytkoSenior Active Directory Engineer
Top Expert 2012

Commented:
You're welcome :)

Krzysztof

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial