New-UDTable -ShowSelection doesn't display selection

Product: PowerShell Universal
Version: 2.7.3

Hey @adam

Seeing an inconsistency with -OnSelection using New-UDTable

When trying to get the selectedRows, sometimes it should the value and sometimes is a empty string.

$Columns = @(
    New-UDTableColumn -Title ComputerName -Property PSComputerName -ShowSort -IncludeInSearch -IncludeInExport -DefaultSortColumn
    New-UDTableColumn -Title FriendlyName -Property FriendlyName -ShowSort -IncludeInSearch -IncludeInExport
    New-UDTableColumn -Title Thumbprint -Property Thumbprint -ShowSort -IncludeInSearch -IncludeInExport
    New-UDTableColumn -Title Expires -Property NotAfter -ShowSort -IncludeInSearch -IncludeInExport -Render {
        New-UDTypography -Text (Get-Date -Date $EventData.NotAfter -Format g)
New-UDTable -Id tblResults -Data $Data -Columns $Columns -Dense -ShowPagination -PageSize 500 -ShowSort -ShowFilter -ShowSearch -ShowExport -ShowSelection
New-UDButton -Text 'Update Certificates' -OnClick {
    $Element = Get-UDElement -Id tblResults
    $ComputerName = $Element.selectedRows.PSComputerName -Split ' '
    Show-UDToast -Message ($ComputerName |Out-String) -Persistent


Server names marked out in red…

I have also seen this behavior on a rare occasion and I do not recall this happening prior to 2.7.3.

1 Like

Tried downgrading to 2.7.2 and seeing the same behavior. I am getting the data from the element and passing it to a script inside PSU. This is the result from the PSU script.

Hey @adam

Have you seen this behavior? 2.7.2 seems to have the same issue.


I haven’t noticed it but I will take a look. I’ll open an issue for this.

1 Like

Hey @adam

Found something interesting. I noticed that the selectedRows property is null when scheduled jobs are running. When the scheduled jobs complete, the selectedRows returns the value.

Oh, weird. Ok. That’s good info. Thanks!

Hey @adam

I think the issue may stem from the fact that we have 28 schedules and I have the max history to 100 (the default) and causing performance issues. I’ve updated the max history on all of our scripts and that’s improved performance. Is there a way to remove job history without the groom job?


Nope. That’s the only place it cleans them up at the moment. Do all your schedules run at once and are you using the integrated environment or something else?

Gotcha. At any given time, there can be 9 running at once (Have a bunch of auto-healing scripts that runs from our monitoring system). Have the -RandomDelay set on the schedules. But unfortunately, even though the performance is much better overall, I am still getting null from the selectedRows property

Ok. Thanks. I will try to reproduce it.

Awesome. Thanks. I’ll do some more testing and get you more info.

After some more testing, I found that setting the max history of each script resolved that issue. The database size was ~370 mb from the max history set at 100 that was causing really bad performance overall