Hi, Why is this code not showing a table? THis code is in the page Home.
$tenantID = "e7bd26b0-8540-830477f31b60"
$applicationID = "ae263764-ea1c-5d1873a9f7b0"
$clientSecret = ConvertTo-SecureString -String "oaQ8Q~" -AsPlainText -Force
$ClientSecretCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $applicationID, $clientSecret
Connect-MgGraph -TenantId $tenantID -ClientSecretCredential $ClientSecretCredential
$complianceStatus = Get-MgDeviceManagementManagedDevice
# Save compliance status object into hashtable
$complianceHashtable = @{}
foreach ($deviceComplianceStatus in $complianceStatus.value) {
$complianceHashtable.Add("id", $deviceComplianceStatus.id)
$complianceHashtable.Add("deviceName", $deviceComplianceStatus.deviceName)
$complianceHashtable.Add("complianceState", $deviceComplianceStatus.complianceState)
$complianceHashtable.Add("enrolledDateTime", $deviceComplianceStatus.enrolledDateTime)
$complianceHashtable.Add("manufacturer", $deviceComplianceStatus.manufacturer)
$complianceHashtable.Add("model", $deviceComplianceStatus.model)
$complianceHashtable.Add("serialNumber", $deviceComplianceStatus.serialNumber)
$complianceHashtable.Add("userDisplayName", $deviceComplianceStatus.userDisplayName)
$complianceHashtable.Add("operatingSystem", $deviceComplianceStatus.operatingSystem)
$complianceHashtable.Add("osVersion", $deviceComplianceStatus.osVersion)
}
$Columns = @(
New-UDTableColumn -Property deviceName -Title "Naam" -IncludeInSearch -IncludeInExport
New-UDTableColumn -Property model -Title "Model" -IncludeInExport
New-UDTableColumn -Property serialNumber -Title "Serienummer" -IncludeInSearch -IncludeInExport
New-UDTableColumn -Property userDisplayName -Title "Primaire gebruiker" -IncludeInSearch -IncludeInExport
New-UDTableColumn -Property operatingSystem -Title "Besturingssysteem" -IncludeInExport
New-UDTableColumn -Property osVersion -Title "Besturingssysteem versie" -IncludeInExport
New-UDTableColumn -Property enrolledDateTime -Title "Datum ingebruikname" -IncludeInExport -Render {
New-UDDateTime -InputObject ($complianceHashtable.enrolledDateTime) -Format 'DD-MM-YYYY'
}
New-UDTableColumn -Property complianceState -Title "Compliance status" -IncludeInExport -Render {
if ($complianceHashtable.complianceState -eq 'compliant') {
$checkIcon = New-UDIcon -Icon 'check' -Size sm -Style @{color = 'rgb(76, 175, 80)'}
New-UDChip -Label "Compliant" -Icon $checkIcon -Style @{backgroundColor = 'rgb(240, 248, 241)'; border = '1px solid rgb(183, 235, 143)'}
} else {
$errorIcon = New-UDIcon -Icon 'ExclamationCircle' -Size sm -Style @{color = 'rgb(244, 67, 54)'}
New-UDChip -Label "Niet compliant!" -Icon $errorIcon -Style @{backgroundColor = 'rgb(254, 239, 238)'; border = '1px solid rgb(255, 204, 199)'}
}
}
)
New-UDTable -Id 'customColumnsTable' -Data $complianceHashtable -Columns $Columns -ShowSearch -Paging -PageSize 2 -ShowSort -Export -ExportOption "csv"
$complianceHashtable
Product: PowerShell Universal
Version: 1.4.6