KAPes musings !

Posts Tagged ‘Active-Directory’

List all sites and relevant subnets and domain controllers

Posted by kapes on September 11, 2009

To list all site names

dsquery site -o rdn -limit 0 > all.sites.txt

To get all associated subnets (all.sites.txt from above command is required)

for /F %A in (all.sites.txt) do For /F %X in (‘dsquery subnet -site %A -o rdn’) do echo %A,%X >> sites.subnets.csv

To get all associated domain controllers (all.sites.txt from above command is required)

for /F %A in (all.sites.txt) do For /F %X in (‘dsquery server -site %A -o rdn’) do echo %A,%X >> sites.Servers.csv

Advertisements

Posted in Uncategorized | Tagged: , | Leave a Comment »