Find application partitions (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 displays the application partitions contained in the 
' default forest

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

set objRootDSE = GetObject("LDAP://RootDSE")
strBase    =  "<LDAP://cn=Partitions," & _
              objRootDSE.Get("ConfigurationNamingContext") & ">;"
strFilter  = "(&(objectcategory=crossRef)(systemFlags=5));"
strAttrs   = "cn,ncName;"
strScope   = "onelevel"

set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADsDSOObject"
objConn.Open "Active Directory Provider"
set objRS = objConn.Execute(strBase & strFilter & strAttrs & strScope)

objRS.MoveFirst
while not objRS.EOF 
   Wscript.Echo objRS.Fields("nCName").Value
   objRS.MoveNext
wend

This code has been viewed 2379 times.

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