you need to use psbase to get to the actual DE object see :
http://mow001.blogspot.com/2006/09/p...directory.html http://mow001.blogspot.com/2006/09/p...ectory_29.html
greetings /\/\o\/\/
"Bmack500" <brett.mack@gmail.com> wrote in message
news:1168976889.770325.95630@m58g2000cwm.googlegroups.com...
> How can I fetch the parent of a directoryentry object? Here's my code:
>
> First, I use a directorysearch to get a list of the DC's ntds objects.
> Then, I iterate through the collection.
> But how can I fetch the $dc's parent object so that I can then get the
> serverreference (a dn to the actual server)?
>
>
> #Search
> $objRootDse = New-Object
> System.DirectoryServices.DirectoryEntry("LDAP://rootDSE")
> $dcQuery = "(&(objectcategory=ntdsdsa))"
> $gcQuery = "(&(objectcategory=ntdsdsa)(options=1))"
> $de = new-object system.directoryservices.directoryentry("LDAP://" +
> $objRootDse.ConfigurationNamingContext)
> $dcSearcher = new-object
> system.directoryservices.directorysearcher($de,$dcQuery)
> $dclist = $dcSearcher.findall()
>
> #Iterate
>
> foreach ($dc in $dcList)
> {
> $objTEST = New-Object System.DirectoryServices.directoryentry
> $objTEST = $dc.GetDirectoryEntry()
> $objTest.distinguishedName
> $props.cn
> $myParent = New-Object System.DirectoryServices.directoryentry
> $myParent = $objTest.parent
> }
>