I have a PS object with name, column2, column3, etc. I have 3 names and values in each of the columns for those names. I want to loop through and put into a table name1, column1, name2, column1, name3, column1, name1, column2, name2, column2, name3, column2, name1, column3, name2, column3, name3, column3, etc. is there a way to do this?
I have tried and object for names and one for columns and using a for each loop. I'm trying to automate lines of code instead of using a select object to select each name and column.
current code:
$obj | sort-object Name | Select-object AER, DER, APRO,FPCT
New-HTML {
New-HTMLSection -Invisible {
New-HTMLSection {
New-HTMLTable -DataTable $obj -includeproperty Name, AER -DefaultSortOrder Descending -PagingLength 10
}
New-HTMLSection {
New-HTMLTable -DataTable $obj -includeproperty Name, DER -DefaultSortOrder Descending -PagingLength 10
}
New-HTMLSection {
New-HTMLTable -DataTable $obj -includeproperty Name, APRO -DefaultSortOrder Descending -PagingLength 10
}
New-HTMLSection {
New-HTMLTable -DataTable $obj -includeproperty Name, FPCT -DefaultSortOrder Descending -PagingLength 10
}
}
Was looking to do something like this:
New-HTML {
New-HTMLSection {
$Machines = @(
'Machine1', 'Machine2', 'Machine3'
)
foreach ($Machine in $Machines) {
New-HTMLSection -HeaderText $Machine {
$Information = @(
'First Information', '2nd Information', '3rd information'
)
foreach ($I in $Information) {
New-HTMLSection -HeaderText $I {
New-HTMLTable -DataTable $Machine
}
}
} -Direction column
}
} -HeaderText "Citrix Machine Information" -Direction column
} -Online -ShowHTML
current and desired output:

Name,<Property>, per property (excluding the name)?