You want to create or delete an application partition. Application partitions are useful if you need to replicate data to a subset of locations where you have domain controllers. Instead of replicating the application data to all domain controllers in a domain, you can use an application partition to only replicate the data to the domain controllers of your choosing.
To create an application partition, do the following:
Open ADSI Edit.
Connect to the domain of which the new application partition will be a child.
In the left pane, right-click on the domain and select New Object.
Select domainDNS and click Next.
For Value, enter the name of the application partition and click Next.
Click on More Attributes.
Select Both for which properties to view.
Select instanceType for property to view.
For the Edit Attribute field, enter 5.
Click the Set button.
To delete an application, do the following:
Open ADSI Edit.
Connect to the configuration naming context of the forest the application partition is in, if it is not already present in the left pane.
Expand the configuration naming context and click on the Partitions container.
In the right pane, right-click on the crossRef object that represents the application partition and select Delete.
Click Yes to confirm.
Use the following command to create an application partition on a domain controller:
> ntdsutil "dom man" conn "co to se <DomainControllerName>" q "create nc[RETURN] <AppPartitionDN> NULL" q q
Use the following command to delete an application partition:
> ntdsutil "dom man" conn "co to se <DomainControllerName>" q "delete nc[RETURN] <AppPartitionFQDN>" q q
' This code creates an application partition off of the ' root of the default forest. ' ------ SCRIPT CONFIGURATION ------ strAppPart = "<AppPartitionName>" ' DN of the app partition to delete strServer = "<DomainControllerName>" ' DNS name of DC to host app partition strDescr = "<Description>" ' Descriptive text about the app partition ' ------ END CONFIGURATION --------- set objRootDSE = GetObject("LDAP://" & strServer & "/RootDSE") set objLDAP = GetObject("LDAP://" & strServer & "/" & _ objRootDSE.Get("rootDomainNamingContext") ) set objAppPart = objLDAP.Create("domainDNS", "dc=" & strAppPart) objAppPart.Put "instancetype", 5 objAppPart.Put "description", strDescr objAppPart.SetInfo WScript.Echo "Created application partition: " & strAppPart ' This code deletes the specified application partition ' ------ SCRIPT CONFIGURATION ------ strAppPart = "<AppPartitionDN>" ' DN of the app partition to delete ' ------ END CONFIGURATION --------- set objRootDSE = GetObject("LDAP://RootDSE") strBase = "<LDAP://cn=Partitions," & _ objRootDSE.Get("ConfigurationNamingContext") & ">;" strFilter = "(&(objectcategory=crossRef)(nCName=" & _ strAppPart & "));" strAttrs = "cn,distinguishedName;" strScope = "onelevel" set objConn = CreateObject("ADODB.Connection") objConn.Provider = "ADsDSOObject" objConn.Open "Active Directory Provider" set objRS = objConn.Execute(strBase & strFilter & strAttrs & strScope) if objRS.RecordCount <> 1 then WScript.Echo "Did not find a match for " & strAppPart else objRS.MoveLast set objAppPart = GetObject("LDAP://" & _ objRS.Fields("distinguishedName").Value ) objAppPart.DeleteObject(0) Wscript.Echo "Deleted " & objRS.Fields("distinguishedName").Value end if
To create an application partition, you need to create a domainDNS object that serves as the root container for the partition. A crossRef object is automatically created in the Partitions container in the CNC. Conversely, when removing an application partition, you only need to remove the crossRef object and the domainDNS is automatically deleted. When you delete an application partition, all objects within the partition also get deleted. Tombstone objects are not created for any of the objects within the application partition or for the application partition itself.
MS KB 322669 (HOW TO: Manage the Application Directory Partition and Replicas in Windows Server 2003), and MSDN: Creating an Application Directory Partition, and MSDN: Deleting an Application Directory Partition