I am trying to find the properties of active directory:
$strFilter = "(&(objectCategory=User))"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.PageSize = 1000
$objSearcher.Filter = $strFilter
$objSearcher.SearchScope = "Subtree"
$colResults = $objSearcher.FindAll()
foreach ($objResult in $colResults){
$objItem = $objResult.Properties
I can call $objitem.name, but I don’t know which other properties I have accessible.
How can I find which properties I can access from $objitem?
edit:
Used this solution using the answers below:
foreach ($objResult in $colResults){
($colResults)[0].Properties.PropertyNames
}
foreach ($objResult in $colResults){ $objResult.Properties | % {$_.propertynames} }should display the keys of each result property.