I thought I would re-post this answer and clarify my code a bit more using a custom object example.
Original solution without pscustomobject:
$bannedCiphers = @{
"RC4 128/128"= @{
"IsPermitted" = $false
"AffectedCiphers" = @(
"SSL_RSA_WITH_RC4_128_MD5",
"SSL_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_RC4_128_MD5",
"TLS_RSA_WITH_RC4_128_SHA"
)
}
"Another RC4"= @{
"IsPermitted" = $false
"AffectedCiphers" = @(
"Cipher1",
"Cipher2",
"Cipher3",
"Cipher4"
)
}
}
The output of this solution will yield $bannedCiphers output:
Name Value
---- -----
Another RC4 {IsPermitted, AffectedCiphers}
RC4 128/128 {IsPermitted, AffectedCiphers}
My solution creating custom objects:
$bannedCiphers2 = [pscustomobject]@{
"RC4 128/128"= @{
"IsPermitted" = $false
"AffectedCiphers" = @(
"SSL_RSA_WITH_RC4_128_MD5",
"SSL_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_RC4_128_MD5",
"TLS_RSA_WITH_RC4_128_SHA"
)
}
"Another RC4"= @{
"IsPermitted" = $false
"AffectedCiphers" = @(
"Cipher1",
"Cipher2",
"Cipher3",
"Cipher4"
)
}
}
The output for my solution will yield $bannedCiphers2 output:
RC4 128/128 Another RC4
----------- -----------
{IsPermitted, AffectedCiphers} {IsPermitted, AffectedCiphers}
original:
$bannedCiphers | Select-Object *
IsReadOnly : False
IsFixedSize : False
IsSynchronized : False
Keys : {Another RC4, RC4 128/128}
Values : {System.Collections.Hashtable, System.Collections.Hashtable}
SyncRoot : System.Object
Count : 2
vs:
$bannedCiphers2 | Select-Object *
RC4 128/128 Another RC4
----------- -----------
{IsPermitted, AffectedCiphers} {IsPermitted, AffectedCiphers}
Name = [string],IsPermitted = [bool], andAffectedCiphers = [array]. that could be stored in an array or another collection type. perhaps a hashtable if you will have many such entries - all with a unique key - and need to look them up quickly.