Greetings,
I am using the directorysearcher to retrieve the value of a custom AD attribute.
I am at a loss to explain this behaviour when I try to retrieve it.
I first run this code:
$searcher = New-Object DirectoryServices.DirectorySearcher
$searcher.Filter = "(&(name=Computer1)(objectClass=computer))"
$searcher.pageSize = 1000
$ADSearchResults = $searcher.FindAll()
I then try to display the custom attribute by running this command:
$ADSearchResults.Properties.CustomReboot
...and nothing is displayed.
If I type this:
$ADSearchResults.Properties.CustomReboot[0]
...then the value is returned - however if I type this:
$ADSearchResults.Properties
...all the properties are returned - now here's the thing - if I now type this:
$ADSearchResults.Properties.CustomReboot
It returns a value where it didnt when I first typed it after the findall command.
Why is this happening?
Thanks
David Z