0

How do I debug this hash set where loop not finding strings with the contains that I know exist in the key field?

# Create a hash set from the local hashes.
$localHashSet = [System.Collections.Generic.HashSet[string]] $localmd5

# Loop over all remote hashes to find those not among the local hashes.
$remotefilehash.Where({ -not $localHashSet.Contains($_) })
# Set the $diffmd5 var to that of the not found remote file hash
Tony
  • 8,681
  • 7
  • 36
  • 55
  • Hash sets are case-_sensitive_ by default. Also note that, unlike the `.Contains()` _string_ method, which finds substrings, only _whole_ values are found. I've closed this as a duplicate of the post where you took the code from, where I've switched to a case-insensitive hash set, to be safe. If that still doesn't help, please provide feedback there. – mklement0 Oct 29 '21 at 21:53
  • As for debugging: hash sets are enumerable, so you can enumerate their entries with `foreach` / `.ForEach()` / `ForEach-Object` to inspect them individually. – mklement0 Oct 29 '21 at 21:55

0 Answers0