Strange behaviors with New-UDTable


I am displaying data from my sql query, and I have setup my data sort already. But when I use the New-UDTable, it auto put the “warning” column as my first column, and removes all the zero values from the query?

Here is my code:

$data = Invoke-DbaQuery -SqlInstance $sqlserver -Database $database -Query $query | ForEach-Object {


    MachineName = $_.MachineName 

    ComponentName = $_.ComponentName

    Status = $_.Status

    Infos = $_.Infos

    Warnings = $_.Warnings

    Errors = $_.Errors



New-UDStyle -Style '

    font-size: 11px;

    .MuiTableCell-root {

    padding: 0px;

}' -Content {

    New-UDTable -Data $data 


And attached is the result.


I’m not exactly sure why this is happening but you can customize the order and output of the table columns by using custom columns: Table - PowerShell Universal

thanks @adam , after I specify the table columns, they display the table correctly now :slight_smile:

1 Like