Skip to content

Commit 83cf20e

Browse files
committed
Fix Admin Templates and winget app platform filtering
Admin Templates (Group Policy) are Windows-only but were passing the platform filter for all device types because Get-PolicyPlatform returns "Multi-Platform" for them. Wrapped in a Windows-only guard instead. Also added winget and microsoftStoreApp types to the Windows app pattern in Test-AppPlatformCompatibility so these app types are not excluded from Windows device results.
1 parent 0006114 commit 83cf20e

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

IntuneAssignmentChecker.ps1

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ function Test-AppPlatformCompatibility {
10111011
if ($typeLower -match "webapp") { return $true }
10121012

10131013
switch ($DeviceOS) {
1014-
"Windows" { return $typeLower -match "win32|windows|officesuite|microsoftstoreforbusiness" }
1014+
"Windows" { return $typeLower -match "win32|windows|officesuite|microsoftstore|winget" }
10151015
"iOS" { return $typeLower -match "ios|ipad|iphone" }
10161016
"macOS" { return $typeLower -match "macos" }
10171017
"Android" { return $typeLower -match "android" }
@@ -3808,15 +3808,17 @@ do {
38083808
}
38093809
}
38103810

3811-
# Get Administrative Templates
3812-
Write-Host "Fetching Administrative Templates..." -ForegroundColor Yellow
3813-
$adminTemplates = Get-IntuneEntities -EntityType "groupPolicyConfigurations"
3814-
foreach ($template in $adminTemplates) {
3815-
$assignments = Get-IntuneAssignments -EntityType "groupPolicyConfigurations" -EntityId $template.id
3816-
$reason = Resolve-AssignmentReason -Assignments $assignments -GroupMembershipIds $groupMemberships.id -IncludeReasons @("All Devices")
3817-
if ($reason -and (Test-PlatformCompatibility -DeviceOS $deviceOS -Policy $template)) {
3818-
$template | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue $reason -Force
3819-
$relevantPolicies.AdminTemplates += $template
3811+
# Get Administrative Templates (Windows-only, Group Policy)
3812+
if (-not $deviceOS -or $deviceOS -eq "Windows") {
3813+
Write-Host "Fetching Administrative Templates..." -ForegroundColor Yellow
3814+
$adminTemplates = Get-IntuneEntities -EntityType "groupPolicyConfigurations"
3815+
foreach ($template in $adminTemplates) {
3816+
$assignments = Get-IntuneAssignments -EntityType "groupPolicyConfigurations" -EntityId $template.id
3817+
$reason = Resolve-AssignmentReason -Assignments $assignments -GroupMembershipIds $groupMemberships.id -IncludeReasons @("All Devices")
3818+
if ($reason) {
3819+
$template | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue $reason -Force
3820+
$relevantPolicies.AdminTemplates += $template
3821+
}
38203822
}
38213823
}
38223824

0 commit comments

Comments
 (0)