Currently I have the below code creating a multidimensional arraylist (but I am not married using arraylists, just need a free-to-add to array type):
$Installs = new-object system.collections.arraylist
$CVAFiles = get-childitem -path $HPImagingAssistantSoftPaqPath -filter *.cva | select fullname
foreach($CVAFile in $CVAFiles)
{
$CVAFileContents = get-content $($CVAFile).fullname -raw
$CVAFileContents -match '(?s).*?\[General\].*?SystemMustBeRebooted=(\d).*?\[Install Execution\].*?SilentInstall=(.*?)\n.*' | out-null
$s = $CVAFile.fullname.split("\")[-1].split(".")[0]
$Installs.add(@($Matches[1],$s,$Matches[2])) | out-null}
}
But because it is multidimensional can't seem to use $Installs.sort() to make it sort by $Installs[1]. And I can't seem to find any other examples of sorting multidimensional arraylists online to see what the correct syntax is.
What is the correct syntax?
Does $Installs = $Installs | Sort-Object { $_[1] }
work per chance?