PowerTip: Find Value from PowerShell Hash Table

Doctor Scripto

Summary: Look up values from a Windows PowerShell hash table.

Hey, Scripting Guy! Question How can I look up a specific value that is associated with a specific key in a Windows PowerShell hash table?

Hey, Scripting Guy! Answer Use the Item method and supply the key, for example:

$hash = @{

   2 = "Removable disk"

   3="Fixed local disk"

   4="Network disk"

   5 = "Compact disk"}

 

$hash.Item(3)

0 comments

Discussion is closed.

Feedback usabilla icon