How to get vertical data in New-UDCard

Hey everyone,

I’m writing a dashboard that will query a server for information. I have the info set in an object, but I’m having troubles displaying this information in a vertical, line-by-line, Format List type view. With this being a single object, I do not want to use a table; else it will be a single row with multiple columns and that looks weird. I’m trying to use New-UDCard to display the data vertically, line-by-line. I’d like to have it look good with white space to line up values, such as…

Server Name:  <servername>
OS Name:      <OSname>
Total RAM:    <totalRAM>

I’ve tried piping the object to format list, then out-string. This works, but the output on the card does not respect the white spacing and the values are not aligned.

$outString = $object | fl | out-string
New-UDCard -Title “Hardware & OS Info” -Text $outString

I’ve tried creating a here string, with all the proper spacing the way I want it, but I get the same results; where New-UDCard does not respect the white space and the values are not aligned.


I’ve tried using HTML as well, both as -Content and as -Text. As -Content I get a nice looking key (as bold) and the value, but there are no line breaks; it just jams them up in a single horizontal line. When I use -Text I simply get the text, or if I use -Text as a here string I get “UniversalDashboard.Models.RawHtml”.

New-UDCard -Title "Hardware & OS Info" -Content {
    New-UDHtml -Markup ("<b>Server Name</b>: " + $OS.PSComputerName + "</ br>")
    New-UDHtml -Markup ("<b>OS Name</b>: " + $OS.Caption + "</ br>")
    New-UDHtml -Markup ("<b>SP Version</b>: " + $OS.ServicePackMajorVersion + "</ br>")

How can I get this data to display vertically (line-by-line), and have the values line up to the right?


hello @Mentat I think you need to have a butchers at this old post:-

as it is related…as for the alignment of the text, you will most likely have to achieve this via CSS and either set it as a theme or use udhelmet module to set the CSS on this particular part of your page

Apologies for the late response, life and work got busy! Unfortunately I do not know CSS, and only a little HTML. However, I am tenacious and I kept digging and testing to figure it out. That old article you sent did help.

I found that New-UDParagraph will take New-UDHtml, where it will respect line breaks with <br>

and you can add additional white spaces using &nbsp; This works both with New-UDPaper and New-UDCard.

Once I have my data loaded into variables, I can do the following…

>     $card_Hardware = New-UDCard -Title "Hardware & OS Info" -Content {
>             New-UDParagraph -Content {
>                 New-UDHtml -Markup ("<b>Server Name:</b>&nbsp; $($OS.PSComputerName.ToUpper())<br>")
>                 New-UDHtml -Markup ("<b>OS Name:</b>&nbsp; $($OS.Caption)<br>")
>                 New-UDHtml -Markup ("<b>OS Architecture:</b>&nbsp; $($OS.OSArchitecture)<br>")
>                 New-UDHtml -Markup ("<b>SP Version:</b>&nbsp; $($OS.ServicePackMajorVersion)<br>")
>                 New-UDHtml -Markup ("<b>Manufacturer:</b>&nbsp; $($BIOS.Manufacturer)<br>")
>                 New-UDHtml -Markup ("<b>Model:</b>&nbsp; $($CompSystem.Model)<br>")
>                 New-UDHtml -Markup ("<b>SerialNumber:</b>&nbsp; $($BIOS.SerialNumber)<br>")
>                 New-UDHtml -Markup ("<b>Processors:</b>&nbsp; $($procCores.NumberOfCores.Count)<br>")
>                 New-UDHtml -Markup ("<b>Cores:</b>&nbsp; $(($procCores.NumberOfCores)[0])<br>")
>                 New-UDHtml -Markup ("<b>Total Cores:</b>&nbsp; $($totalCores)<br>")
>                 New-UDHtml -Markup ("<b>Total RAM (GB):</b>&nbsp; $($totalRAM.TotalPhysicalRAM)<br>")
>                 New-UDHtml -Markup ("<b>BIOS Name:</b>&nbsp; $($BIOS.Name)<br>")
>                 New-UDHtml -Markup ("<b>BIOS Version:</b>&nbsp; $($BIOS.Version)<br>")
>                 New-UDHtml -Markup ("<b>SMBIOS BIOS Version:</b>&nbsp; $($BIOS.SMBIOSBIOSVersion)")
>                     }
>                 }# $card_Hardware


Thanks for the assist!
Rob Walden


You can always use foreach to manage this I have done lite like this but for the grind.

                    New-UDGrid -Item -MediumSize 4 -Content {
                            $usergroup = (Get-ADUser $username -Properties memberOf | Select -ExpandProperty memberOf) | % {$_.Replace("CN=","").Split(",") | Select -First 1}
                                New-UDHtml -Markup "$($_)<br>"