KAPes musings !

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: