Hello All,
I need some help.
I am running an AD search and I receive the output of the recordset in a variable.
When I print out the variable it shows that the variable contains an unnamed hash table.
I have tried everything I can think of to access the value in the hash table to make a comparison to.
Ultimate goal. verify the system in the variable $strTargetHost is found in AD.
code snippet - psudo code
inside a for loop containing the names of the host systems I want to search for
retrieve the results of the Search
$searchResult = $objRecordSet.fields.item(“name”) | Select-Object Name,Value
Write-Host "DEBUG: searchResult = " $searchResult
if ($objRecordSet.fields.item("name") -match $strTargetHost) { #latest iteration of attempts to access the Value data returned in the hash table array
write out the data to a file
}
When I print out the contents of $searchResult = @{Name=name, Value=99W7XLN1}
Question: How can I access the array that is being stored in $searchResult?
How can I compare the Value ( in this case “99W7XLN1” to desired host ($strTargetHost) which is the same value 99W7XLN1
Any assistance you could provide would be greatly appreciated.
Thanks,