Recipe 11.1 Creating a Site

11.1.1 Problem

You want to create a site.

11.1.2 Solution Using a graphical user interface
  1. Open the Active Directory Sites and Services snap-in.

  2. Right-click on the Sites container and select New Site.

  3. Beside Name, enter the name of the new site.

  4. Under Link Name, select a site link for the site.

  5. Click OK twice. Using a command-line interface

Create an LDIF file called create_site.ldf with the following contents:

dn: cn=<SiteName>,cn=sites,cn=configuration,<ForestRootDN>
changetype: add
objectclass: site

dn: cn=Licensing Site Settings,cn=<SiteName>,cn=sites,cn=configuration, <ForestRootDN>
changetype: add
objectclass: licensingSiteSettings

dn: cn=NTDS Site Settings,cn=<SiteName>,cn=sites,cn=configuration,<ForestRootDN>
changetype: add
objectclass: nTDSSiteSettings

dn: cn=Servers,cn=<SiteName>,cn=sites,cn=configuration,<ForestRootDN>
changetype: add
objectclass: serversContainer

then run the following command:

> ldifde -v -i -f create_site.ldf Using VBScript
' This code creates the objects that make up a site.
strSiteName = "<SiteName>"  ' e.g. Dallas
' ------ END CONFIGURATION ---------

set objRootDSE = GetObject("LDAP://RootDSE")
set objSitesCont = GetObject("LDAP://cn=sites," & _
                             objRootDSE.Get("configurationNamingContext") )
' Create the site
set objSite = objSitesCont.Create("site","cn=" & strSiteName)

' Create the Licensing Site Settings object
set objLicensing = objSite.Create("licensingSiteSettings", _
                                  "cn=Licensing Site Settings")

' Create the NTDS Site Settings object
set objNTDS = objSite.Create("nTDSSiteSettings","cn=NTDS Site Settings")

' Create the Servers container
set objServersCont = objSite.Create("serversContainer","cn=Servers")

WScript.Echo "Successfully created site " & strSiteName

11.1.3 Discussion

To create a site in Active Directory, you have to create a number of objects. The first is a site object, which is the root of all the other objects. The site object contains the following:


This object isn't mandatory, but is created automatically when creating a site with AD Sites and Services. It is intended to point clients to a license server for the site.


This object stores replication-related properties about a site, such as the replication schedule, current ISTG role holder, and whether universal group caching is enabled.


This container is the parent of the server objects that are part of the site. All the domain controllers that are members of the site will be represented in this container.

After these objects are created, you've essentially created an empty site. If you didn't do anything else, the site would not be of much value. To make it usable, you need to assign subnet objects to it (see Recipe 11.4), and add the site to a siteLink object to link the site to other sites (see Recipe 11.7). At that point, you can promote or move domain controllers into the site, and it should be fully functional.

11.1.4 See Also

MS KB 318480 (HOW TO: Create and Configure an Active Directory Site in Windows 2000)

    Chapter 3. Domain Controllers, Global Catalogs, and FSMOs
    Chapter 6. Users
    Appendix A. Tool List