How to 'stack' multiple data tables under single New-HTMLContent #322
-
I have tried many, many different variations and combinations, but I just can't seem to get two data tables to stack on top of each other when buried in a ForEach statement to create new-HTMLContent. They always align side by side. My code is (will try to shorten it, but can't seem to get formatting to work right on here): New-HTMLContent -HeaderText "Citrix Machine Information" -HeaderTextSize "16" -HeaderTextColor "#ffffff" -HeaderBackGroundColor "#383392" -BackgroundColor "#707cf1" -AlignContent center -AlignItems center -CanCollapse {
try
{
$CtxMachine01Info = @()
$CtxMachine02Info = @()
$CtxMachineInfo = Invoke-Command -Computer $Computer {Get-BrokerMachine | Select * | Sort -Property CatalogName, DNSName} | Select -Property * -ExcludeProperty PSComputerName, RunSpaceID, PSShowComputerName
foreach ($Machine in $CtxMachineInfo)
{
New-HTMLContent -HeaderText $Machine.DNSName -HeaderTextSize "16" -HeaderTextColor "#ffffff" -HeaderBackGroundColor "#383392" -BackgroundColor "#707cf1" -AlignContent center -AlignItems center -CanCollapse -Collapsed {
$CtxMach01Obj = New-Object PSObject
$CtxMach01Obj | Add-Member NoteProperty -Name "Name" -Value $CtxMachineInfo.DNSName
$CtxMach01Obj | Add-Member NoteProperty -Name "Machine Catalog" -Value CtxMachineInfo.CatalogName
$CtxMachine01Info += $CtxMach01Obj
$CtxMach02Obj = New-Object PSObject
$CtxMach02Obj | Add-Member NoteProperty -Name "Broker" -Value $CtxMachineInfo.ControllerDNSName
$CtxMach02Obj | Add-Member NoteProperty -Name "Registration State" -Value $CtxMachineInfo.RegistrationState
$CtxMachine02Info += $CtxMach02Obj
New-HTMLTable -DataTable $CtxMachine01Info -HideFooter -HideButtons -DisableSearch
New-HTMLTable -DataTable $CtxMachine02Info -HideFooter -HideButtons -DisableSearch
}
Write-Color "n $Computer ", "Citrix Machine Data Collection ", "Complete. n" -Color Cyan, White, Green
} As mentioned, I've tried so many different combinations and trying to wrap the New-HTMLTable entries in varies Panels/Content etc, but just can't seem to get the two data tables to stack on top of each other. Anyone have any ideas? Any help is most appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
New-HTML {
New-HTMLSection {
$Machines = @(
'Test1', 'Test2'
)
foreach ($Machine in $Machines) {
New-HTMLSection -HeaderText $Machine {
New-HTMLTable -DataTable $Machine
}
}
} -HeaderText "Citrix Machine Information" -Direction column
} -Online -ShowHTML
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the reply. I tried to use -Direction column but it didn't seem to have any effect. In your example, you've only got a single HTMLTable, but I've got two data tables that I'm trying to stack on top of each other within the foreach statement. It still puts both tables side by side instead of on top of each other. |
Beta Was this translation helpful? Give feedback.
-
Okay, I see what you're saying. But in your example, you have two machines, and each is getting it's own section within the main 'Citrix Machine Info' section. That part is working as expected in my example. So if I have 10 machines, each machine is getting it's own section. |
Beta Was this translation helpful? Give feedback.
-
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 Works for me |
Beta Was this translation helpful? Give feedback.
Works for me