# encoding: ascii
# api: powershell
# title: nested hashtables
# description: Example using objects…
# version: 0.1
# author: smaug9
# license: CC0
# x-poshcode-id: 5763
# x-archived: 2015-03-15T15:21:38
# x-published: 2015-03-02T20:19:00
#
#
$Array1 = New-Object -TypeName PSObject -Property @{
ArrayName = "Array01"
Controller01Name = "vHBA1"
Controller01WWN = "foobarfoobarfoobar01"
Controller02Name = "vHBA2"
Controller02WWN = "foobarfoobarfoobar02"
}
$Array2 = New-Object -TypeName PSObject -Property @{
ArrayName = "Array02"
Controller01Name = "vHBA1"
Controller01WWN = "foobarfoobarfoobar01"
Controller02Name = "vHBA2"
Controller02WWN = "foobarfoobarfoobar02"
}
$FabricA = @{
SwitchIP = "1.2.3.4"
VsanID = "Vsan01"
ZoneSetname = "FabricA"
Arrays = $Array1, $Array2
}
$FabricA.Arrays | Where {$_.arrayname -like '*01'}
# Many other examples here http://social.technet.microsoft.com/wiki/contents/articles/7804.powershell-creating-custom-objects.aspx