Friday, February 20, 2009

Find domains in a forest on command line

To findout list of domains in a forest through command prompt, do the following

1. Assume the dns server (Domain Controller) is dnsserver2003.
2. Now run the below command to list the domains contained in a forest.

ntdsutil "d m" "sel op tar" c "co t s dnsserver2003" q "l d" q q q
3. Dsquery command also be used to view the domains, just run the below command.
dsquery * -filter "objectcategory=domainDNS" -scope subtree

Third party tools like adfind can also be used to find domains in a forest.
adfind root s subtree f "objectcategory=domainDNS" -dn


Design by infinityskins.blogspot