Skip to Content
Active Directory Cookbook
book

Active Directory Cookbook

by Robbie Allen
September 2003
Intermediate to advanced
624 pages
15h 49m
English
O'Reilly Media, Inc.
Content preview from Active Directory Cookbook

11.2. Listing the Sites

Problem

You want to obtain the list of sites.

Solution

Using a graphical user interface

  1. Open the Active Directory Sites and Services snap-in.

  2. Click on the Sites container.

  3. The list of sites will be displayed in the right pane.

  4. Double-click on a site to view its properties.

Using a command-line interface

Run the following command to list the sites:

> dsquery site

Run the following command to view the properties for a particular site:

> dsget site "<SiteName>"

Using VBScript

' This code lists all of the site objects.

set objRootDSE = GetObject("LDAP://RootDSE")
set objSitesCont = GetObject("LDAP://cn=sites," & _
                             objRootDSE.Get("configurationNamingContext") )
objSitesCont.Filter = Array("site")
for each objSite in objSitesCont
   Wscript.Echo "  " & objSite.Get("cn")
next

Discussion

Site objects are stored in the Sites container (e.g., cn=sites,cn=configuration,dc=rallencorp,dc=com) in the Configuration Naming Context (CNC). For more information on creating sites, see Recipe 11.1.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Active Directory Administration Cookbook

Active Directory Administration Cookbook

Sander Berkouwer
Active Directory Cookbook, 3rd Edition

Active Directory Cookbook, 3rd Edition

Laura E. Hunter, Robbie Allen
Active Directory Cookbook, 4th Edition

Active Directory Cookbook, 4th Edition

Brian Svidergol, Robbie Allen

Publisher Resources

ISBN: 0596004648Supplemental ContentCatalog PageErrata