Skip to content

Commit a956c55

Browse files
ugurkocdeclaude
andcommitted
Add Platform data to all policy types for consistent filtering
- All non-app policy hashtables now include a Platform field (Get-PolicyPlatform for configs/compliance/endpoint security, hardcoded "Windows" for scripts/Autopilot/ESP/CloudPC) - "All Policies & Apps" tab shows platform for all rows, not just apps - Per-category tabs now all include a Platform column - Removed isAppCategory branching since all categories have Platform - Fixes platform filter hiding non-app rows on the "All" tab Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3815c95 commit a956c55

1 file changed

Lines changed: 22 additions & 30 deletions

File tree

html-export.ps1

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ function Export-HTMLReport {
629629
Name = $config.displayName
630630
ID = $config.id
631631
Type = "Device Configuration"
632+
Platform = Get-PolicyPlatform -Policy $config
632633
ScopeTags = Get-ScopeTagNames -ScopeTagIds $config.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
633634
AssignmentType = $assignmentInfo.Type
634635
AssignedTo = $assignmentInfo.Target
@@ -648,6 +649,7 @@ function Export-HTMLReport {
648649
Name = if (-not [string]::IsNullOrWhiteSpace($policy.displayName)) { $policy.displayName } else { $policy.name }
649650
ID = $policy.id
650651
Type = "Settings Catalog"
652+
Platform = Get-PolicyPlatform -Policy $policy
651653
ScopeTags = Get-ScopeTagNames -ScopeTagIds $policy.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
652654
AssignmentType = $assignmentInfo.Type
653655
AssignedTo = $assignmentInfo.Target
@@ -663,6 +665,7 @@ function Export-HTMLReport {
663665
Name = $template.displayName
664666
ID = $template.id
665667
Type = "Administrative Template"
668+
Platform = Get-PolicyPlatform -Policy $template
666669
ScopeTags = Get-ScopeTagNames -ScopeTagIds $template.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
667670
AssignmentType = $assignmentInfo.Type
668671
AssignedTo = $assignmentInfo.Target
@@ -678,6 +681,7 @@ function Export-HTMLReport {
678681
Name = $policy.displayName
679682
ID = $policy.id
680683
Type = "Compliance Policy"
684+
Platform = Get-PolicyPlatform -Policy $policy
681685
ScopeTags = Get-ScopeTagNames -ScopeTagIds $policy.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
682686
AssignmentType = $assignmentInfo.Type
683687
AssignedTo = $assignmentInfo.Target
@@ -711,6 +715,7 @@ function Export-HTMLReport {
711715
Name = $policy.displayName
712716
ID = $policy.id
713717
Type = "App Protection Policy ($($policyType.Split('.')[-1].Replace('ManagedAppProtection','')))"
718+
Platform = Get-PolicyPlatform -Policy $policy
714719
ScopeTags = Get-ScopeTagNames -ScopeTagIds $policy.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
715720
AssignmentType = $assignmentInfo.Type
716721
AssignedTo = $assignmentInfo.Target
@@ -732,6 +737,7 @@ function Export-HTMLReport {
732737
Name = $script.displayName
733738
ID = $script.id
734739
Type = "PowerShell Script"
740+
Platform = "Windows"
735741
ScopeTags = Get-ScopeTagNames -ScopeTagIds $script.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
736742
AssignmentType = $assignmentInfo.Type
737743
AssignedTo = $assignmentInfo.Target
@@ -748,6 +754,7 @@ function Export-HTMLReport {
748754
Name = $script.displayName
749755
ID = $script.id
750756
Type = "Proactive Remediation Script"
757+
Platform = "Windows"
751758
ScopeTags = Get-ScopeTagNames -ScopeTagIds $script.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
752759
AssignmentType = $assignmentInfo.Type
753760
AssignedTo = $assignmentInfo.Target
@@ -764,6 +771,7 @@ function Export-HTMLReport {
764771
Name = $profile.displayName
765772
ID = $profile.id
766773
Type = "Autopilot Deployment Profile"
774+
Platform = "Windows"
767775
ScopeTags = Get-ScopeTagNames -ScopeTagIds $profile.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
768776
AssignmentType = $assignmentInfo.Type
769777
AssignedTo = $assignmentInfo.Target
@@ -781,6 +789,7 @@ function Export-HTMLReport {
781789
Name = $esp.displayName
782790
ID = $esp.id
783791
Type = "Enrollment Status Page"
792+
Platform = "Windows"
784793
ScopeTags = Get-ScopeTagNames -ScopeTagIds $esp.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
785794
AssignmentType = $assignmentInfo.Type
786795
AssignedTo = $assignmentInfo.Target
@@ -798,6 +807,7 @@ function Export-HTMLReport {
798807
Name = if (-not [string]::IsNullOrWhiteSpace($policy.displayName)) { $policy.displayName } else { $policy.name }
799808
ID = $policy.id
800809
Type = "Windows 365 Cloud PC Provisioning Policy"
810+
Platform = "Windows"
801811
ScopeTags = Get-ScopeTagNames -ScopeTagIds $policy.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
802812
AssignmentType = $assignmentInfo.Type
803813
AssignedTo = $assignmentInfo.Target
@@ -819,6 +829,7 @@ function Export-HTMLReport {
819829
Name = if (-not [string]::IsNullOrWhiteSpace($setting.displayName)) { $setting.displayName } else { $setting.name }
820830
ID = $setting.id
821831
Type = "Windows 365 Cloud PC User Setting"
832+
Platform = "Windows"
822833
ScopeTags = Get-ScopeTagNames -ScopeTagIds $setting.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
823834
AssignmentType = $assignmentInfo.Type
824835
AssignedTo = $assignmentInfo.Target
@@ -855,6 +866,7 @@ function Export-HTMLReport {
855866
Name = if (-not [string]::IsNullOrWhiteSpace($policy.displayName)) { $policy.displayName } else { $policy.name }
856867
ID = $policy.id
857868
Type = $esCategory.UserFriendlyType
869+
Platform = Get-PolicyPlatform -Policy $policy
858870
ScopeTags = Get-ScopeTagNames -ScopeTagIds $policy.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
859871
AssignmentType = $assignmentInfo.Type
860872
AssignedTo = $assignmentInfo.Target
@@ -877,6 +889,7 @@ function Export-HTMLReport {
877889
Name = if (-not [string]::IsNullOrWhiteSpace($policy.displayName)) { $policy.displayName } else { $policy.name }
878890
ID = $policy.id
879891
Type = $esCategory.UserFriendlyType
892+
Platform = Get-PolicyPlatform -Policy $policy
880893
ScopeTags = Get-ScopeTagNames -ScopeTagIds $policy.roleScopeTagIds -ScopeTagLookup $script:ScopeTagLookup
881894
AssignmentType = $assignmentInfo.Type
882895
AssignedTo = $assignmentInfo.Target
@@ -1038,7 +1051,6 @@ function Export-HTMLReport {
10381051
"@
10391052

10401053
if ($category.Key -eq 'all') {
1041-
$appCategoryKeys = @('RequiredApps', 'AvailableApps', 'UninstallApps')
10421054
$allTableRows = foreach ($cat in $categories | Where-Object { $_.Key -ne 'all' }) {
10431055
if ($policies.ContainsKey($cat.Key)) {
10441056
$categoryPolicies = $policies[$cat.Key]
@@ -1051,10 +1063,9 @@ function Export-HTMLReport {
10511063
'Exclude' { 'badge-exclude' }
10521064
default { 'badge-none' }
10531065
}
1054-
$platformValue = if ($cat.Key -in $appCategoryKeys) { $p.Platform } else { "" }
10551066
"<tr>
10561067
<td>$($p.Name)</td>
1057-
<td>$platformValue</td>
1068+
<td>$($p.Platform)</td>
10581069
<td>$($p.ScopeTags)</td>
10591070
<td><span class='badge $badgeClass'>$($p.AssignmentType)</span></td>
10601071
<td>$($p.AssignedTo)</td>
@@ -1088,7 +1099,6 @@ function Export-HTMLReport {
10881099
"@
10891100
}
10901101
else {
1091-
$isAppCategory = $category.Key -in @('RequiredApps', 'AvailableApps', 'UninstallApps')
10921102
$tableRows = "" # Initialize to empty string
10931103
if ($policies.ContainsKey($category.Key)) {
10941104
$currentCategoryPolicies = $policies[$category.Key]
@@ -1101,39 +1111,21 @@ function Export-HTMLReport {
11011111
'Exclude' { 'badge-exclude' }
11021112
default { 'badge-none' }
11031113
}
1104-
if ($isAppCategory) {
1105-
"<tr>
1106-
<td>$($p.Name)</td>
1107-
<td>$($p.Platform)</td>
1108-
<td>$($p.ScopeTags)</td>
1109-
<td><span class='badge $badgeClass'>$($p.AssignmentType)</span></td>
1110-
<td>$($p.AssignedTo)</td>
1111-
</tr>"
1112-
}
1113-
else {
1114-
"<tr>
1115-
<td>$($p.Name)</td>
1116-
<td>$($p.ScopeTags)</td>
1117-
<td><span class='badge $badgeClass'>$($p.AssignmentType)</span></td>
1118-
<td>$($p.AssignedTo)</td>
1119-
</tr>"
1120-
}
1114+
"<tr>
1115+
<td>$($p.Name)</td>
1116+
<td>$($p.Platform)</td>
1117+
<td>$($p.ScopeTags)</td>
1118+
<td><span class='badge $badgeClass'>$($p.AssignmentType)</span></td>
1119+
<td>$($p.AssignedTo)</td>
1120+
</tr>"
11211121
}
11221122
}
11231123
}
1124-
$categoryHeaders = if ($isAppCategory) {
1125-
"<th>Name</th>
1124+
$categoryHeaders = "<th>Name</th>
11261125
<th>Platform</th>
11271126
<th>Scope Tags</th>
11281127
<th>Assignment Type</th>
11291128
<th>Assigned To</th>"
1130-
}
1131-
else {
1132-
"<th>Name</th>
1133-
<th>Scope Tags</th>
1134-
<th>Assignment Type</th>
1135-
<th>Assigned To</th>"
1136-
}
11371129
$tabContent += @"
11381130
<div class='tab-pane fade$(if($isActive -and $category.Key -ne 'all'){ ' show active' } else { '' })'
11391131
id='$categoryId'

0 commit comments

Comments
 (0)