New-UDTable 2 Column Name:Value Property List

Product: PowerShell Universal
Version: 1.5.15
UniversalDashboard: 3.3.4

In powershell universal dashboard v2.9 I used to do a New UDTable that would let you list properties of a hash table like this.

Respective Code:

New-UDTable -Title “$($MU.UserPrincipalName) Details” -Headers @(" ", " ") -Endpoint {
@{
‘Name’ = $MU.DisplayName
‘Email’ = $MU.UserPrincipalName
‘Licensed’ = if($MU.IsLicensed -eq $true) {“Yes”} else {“No”}
‘Password Changed’ = $MU.LastPasswordChangeTimestamp
‘Sign-in Blocked’ = if($MU.BlockCredential) {“Yes”} else {“No”}
‘Admin Roles’ = $MUR.Name -join ', ’
}.GetEnumerator() | Out-UDTableData -Property @(“Name”, “Value”)
}

I when I pass a similar hash table to the -Data parameter of the v3 New-UDTable I get this.
image

Respective code:

$TableData = @{
‘Password Changed’ = $MU.LastPasswordChangeDateTime
Name = $MU.DisplayName
‘Admin Roles’ = $MUR.DisplayName -join ', ’
Email = $MU.UserPrincipalName
‘Enabled’ = $MU.AccountEnabled
}
$TableColumns = @(
New-UDTableColumn -Property Name -Title ’ ’
New-UDTableColumn -Property Value -Title ’ ’
)
New-UDTable -Data ($TableData.GetEnumerator()) -Columns $TableColumns

How can I accomplish this in v3’s New-UDTable?

Hmmm I’m having a hard time reproducing this.

    $TableData = @{
        "Password Changed" = "Test"
        Name = "test"
        "Admin Roles" = "test"
        Email = "test"
        "Enabled" = "TEST"
    }
    $TableColumns = @(
New-UDTableColumn -Property Name -Title ’ ’
New-UDTableColumn -Property Value -Title ’ ’
)
    New-UDTable -Data @($TableData.GetEnumerator()) -Columns $TableColumns

Are you using PS7 or WinPS?

I’m using Powershell 7.1.3 in Ubuntu I noticed a single difference, you’re using @() for the data parameter. I’ll give that a shot and see.

1 Like

Looks like that was it!
image

2 Likes