Reputation: 560
I've added what I thought the distinguished name should be 'dn' but it comes back blank. The givenname and sn fields are returned OK.
Thanks.
$Dom = 'LDAP://DC=oakland;DC=local'
$Root = New-Object DirectoryServices.DirectoryEntry $Dom
$i=0
$selector = New-Object DirectoryServices.DirectorySearcher
$selector.SearchRoot = $root
$adobj= $selector.findall() | where {$_.properties.objectcategory -match "CN=Person"}
foreach ($person in $adobj){
$prop=$person.properties
$i++
Write-Host "$($prop.givenname) $($prop.sn) $($prop.dn)"
}
"Total $i"
Upvotes: 0
Views: 256