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>
etc.
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?
Thanks,