Break On $nul=SetOption("WrapAtEOL","On") Color w+/n "=== RootDSE Tutorial =================================================" ? Color w/n "Each directory server has a unique entry called RootDSE. It provides " ? "data about the server, such as its capabilities, the LDAP version it " ? "supports, and the naming contexts it uses."? ? "For example, to create a script, or application, that can run on any " ? "Windows 2000 domain environment. You can specify either the distinguished " ? "name, server name, or domain name when connecting to Active Directory. " ? "If you do not have this information, you can then use the RootDSE object " ? "to establish a connection. The following code example displays the Default " ? "Naming Context for your domain:"? ? Color w+/n '$sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")'? '"RootDSE for this domain is: " + $sADsPath ?'?? Color w/n Color m+/n "Press any key to run the example..." Get $ ?? Color w/n Color w+/n $sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext") "RootDSE for this domain is: " + $sADsPath ?? Color w/n Color m+/n "More..." Get $ ?? Color w/n "Now that we have the Default Naming Context in $$sADsPath, we can use it to " ? 'bind to your domain. This is called "Serverless Binding."' ?? Color w+/n '$objDomain = GetObject($$sADsPath)' ?? Color w/n $objDomain = GetObject($sADsPath) Color m+/n "More..." Get $ ?? Color w/n "Ok. We've found the Default Naming Context and used it to bind to your domain. " ?? "Now what?" ?? "Let's use our newly created domain object to enumerate your root Containers " ? "and Organizational Units." ?? "By constructing a For..Next loop using the $$objDomain we can list each object " ? "in the root of your domain (these should only be Organizational Units (OU's) " ? "and Containers (CN's)). Example..." ?? Color w+/n '"Objects in " + $$objDomain.ADsPath ??' ? 'For Each $$objContainer in $$objDomain' ? ' $$objContainer.Name ?' ? 'Next' ?? Color w/n Color m+/n "Press any key to run the example..." Get $ ?? Color w/n Color w+/n "Objects in " + $objDomain.ADsPath ?? For Each $objContainer in $objDomain $objContainer.Name ? Next Color w/n Color m+/n ? "Press any key to end the tutorial." Get $ ?? Color w/n Exit For Each $objContainer in $objDomain ? "*** "+$objContainer.Name+" ***" ? For Each $obj in $objContainer $obj.Name ? Next Get $ Next Get $ Exit $oRootDSE = GetObject("LDAP://rootDSE") "Default Naming Context: " + $oRootDSE.Get(defaultNamingContext) ?? $aNamingContexts = $oRootDSE.Get(namingContexts) "All Naming Contexts:" ? For Each $sNamingContext in $aNamingContexts "+-- " + $sNamingContext ? Next "DS Service Name: " $oRootDSE.Get(dsServiceName) ? Get $ Exit |