powershell - How do I retrieve a HashTable key from a value? -
i have powershell hashtable contains set of key-value pairs (naturally). of hashtable values unique.
i retrieve hashtable key, based on value specify, using powershell.
another options:
- to iterate on hashtable keys , find key contains value:
$hashtable.keys |? { $hashtable[$_] -eq $val }
to iterate using
getenumerator()
function:$hashtable.getenumerator() | ?{ $_.value -eq $val } | %{ $_.key }
Comments
Post a Comment