Create an application partition (VBScript)

This code can be found in Chapter 18 of Active Directory Cookbook, 2nd edition

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This VBScript code creates an application partition off of the 
' root of the default forest.

' ---------------------------------------------------------------
' From the book "Active Directory Cookbook" by Robbie Allen
' ISBN: 0-596-00466-4
' ---------------------------------------------------------------

' ------ 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 has been viewed 1913 times.

New from the creators of TechTasks.com: StatSheet.com