First find your callable methods and properties using get-member
$FloorIpTest = @{"10.7.20" = "20"; "10.7.21" = "21"; "10.7.22" = "10.7.22"}
$FloorIpTest | get-member
TypeName: System.Collections.Hashtable
Name MemberType Definition
---- ---------- ----------
Add Method System.Void Add(System.Object key, System.Object value)
Clear Method System.Void Clear()
Clone Method System.Object Clone()
Contains Method bool Contains(System.Object key)
ContainsKey Method bool ContainsKey(System.Object key)
ContainsValue Method bool ContainsValue(System.Object value)
CopyTo Method System.Void CopyTo(array array, int arrayIndex)
Equals Method bool Equals(System.Object obj)
GetEnumerator Method System.Collections.IDictionaryEnumerator GetEnumerator()
GetHashCode Method int GetHashCode()
GetObjectData Method System.Void GetObjectData(System.Runtime.Serialization.SerializationInfo inf...
GetType Method type GetType()
OnDeserialization Method System.Void OnDeserialization(System.Object sender)
Remove Method System.Void Remove(System.Object key)
ToString Method string ToString()
Item ParameterizedProperty System.Object Item(System.Object key) {get;set;}
Count Property System.Int32 Count {get;}
IsFixedSize Property System.Boolean IsFixedSize {get;}
IsReadOnly Property System.Boolean IsReadOnly {get;}
IsSynchronized Property System.Boolean IsSynchronized {get;}
Keys Property System.Collections.ICollection Keys {get;}
SyncRoot Property System.Object SyncRoot {get;}
Values Property System.Collections.ICollection Values {get;}
You already have a hashtable. GetHashCode method is there if you want to use it. But as I understand you want to iterate all of your members only.
$FloorIpTest = @{"10.7.20" = "20"; "10.7.21" = "21"; "10.7.22" = "10.7.22"}
[string]$testip = "10.7.20"
Foreach ($key in $FlooripTest.Keys)
{
write-host "key: $key"
write-host "value: $FlooripTest[$key]"
write-host "hashcode: $FlooripTest[$key].GetHashCode()""
}
$valueto contain there? Because you know that the result of$FlooripTest.ContainsKey($testip)isTrue. (Hint: See whatecho $true.valuesoutputs.)