I am trying to find the properties of the 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 do not know what other properties I have available.
How can I find which properties I can get from $ objitem?
edit:
This solution is used using the answers below:
foreach ($objResult in $colResults){
($colResults)[0].Properties.PropertyNames
}
source
share