Skip to content

Commit 539b195

Browse files
authored
Merge pull request #99 from markorr321/fix/autopilot-deployment-profile-bug
Fix Autopilot Deployment Profile variable bug and add missing device …
2 parents aeeddc1 + 4fd8b2e commit 539b195

1 file changed

Lines changed: 28 additions & 12 deletions

File tree

IntuneAssignmentChecker.ps1

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3378,8 +3378,8 @@ do {
33783378
}
33793379

33803380
if ($assignmentReasons.Count -gt 0) {
3381-
$profile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue ($assignmentReasons -join "; ") -Force
3382-
$relevantPolicies.DeploymentProfiles += $profile
3381+
$policyProfile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue ($assignmentReasons -join "; ") -Force
3382+
$relevantPolicies.DeploymentProfiles += $policyProfile
33833383
}
33843384
}
33853385
}
@@ -3724,6 +3724,8 @@ do {
37243724
FirewallProfiles = @()
37253725
EndpointDetectionProfiles = @()
37263726
AttackSurfaceProfiles = @()
3727+
DeploymentProfiles = @()
3728+
ESPProfiles = @()
37273729
CloudPCProvisioningPolicies = @()
37283730
CloudPCUserSettings = @()
37293731
}
@@ -3913,13 +3915,13 @@ do {
39133915
foreach ($assignment in $assignments) {
39143916
if (($assignment.Reason -eq "All Devices") -or
39153917
($assignment.Reason -eq "Group Assignment" -and $groupMemberships.id -contains $assignment.GroupId)) {
3916-
$profile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue $assignment.Reason -Force
3917-
$relevantPolicies.DeploymentProfiles += $profile
3918+
$policyProfile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue $assignment.Reason -Force
3919+
$relevantPolicies.DeploymentProfiles += $policyProfile
39183920
break
39193921
}
39203922
elseif ($assignment.Reason -eq "Group Exclusion" -and $groupMemberships.id -contains $assignment.GroupId) {
3921-
$profile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue "Excluded" -Force
3922-
$relevantPolicies.DeploymentProfiles += $profile
3923+
$policyProfile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue "Excluded" -Force
3924+
$relevantPolicies.DeploymentProfiles += $policyProfile
39233925
break
39243926
}
39253927
}
@@ -4519,6 +4521,18 @@ do {
45194521
if ([string]::IsNullOrWhiteSpace($script.name)) { $script.displayName } else { $script.name }
45204522
}
45214523

4524+
# Display Autopilot Deployment Profiles
4525+
Format-PolicyTable -Title "Autopilot Deployment Profiles" -Policies $relevantPolicies.DeploymentProfiles -GetName {
4526+
param($policyProfile)
4527+
if ([string]::IsNullOrWhiteSpace($policyProfile.displayName)) { $policyProfile.name } else { $policyProfile.displayName }
4528+
}
4529+
4530+
# Display Enrollment Status Page Profiles
4531+
Format-PolicyTable -Title "Enrollment Status Page Profiles" -Policies $relevantPolicies.ESPProfiles -GetName {
4532+
param($esp)
4533+
if ([string]::IsNullOrWhiteSpace($esp.displayName)) { $esp.name } else { $esp.displayName }
4534+
}
4535+
45224536
# Display Required Apps
45234537
Format-PolicyTable -Title "Required Apps" -Policies $relevantPolicies.AppsRequired -GetName {
45244538
param($app)
@@ -4567,6 +4581,8 @@ do {
45674581
Add-ExportData -ExportData $exportData -Category "App Configuration Policy" -Items $relevantPolicies.AppConfigurationPolicies -AssignmentReason { param($item) $item.AssignmentReason }
45684582
Add-ExportData -ExportData $exportData -Category "Platform Scripts" -Items $relevantPolicies.PlatformScripts -AssignmentReason { param($item) $item.AssignmentReason }
45694583
Add-ExportData -ExportData $exportData -Category "Proactive Remediation Scripts" -Items $relevantPolicies.HealthScripts -AssignmentReason { param($item) $item.AssignmentReason }
4584+
Add-ExportData -ExportData $exportData -Category "Autopilot Deployment Profile" -Items $relevantPolicies.DeploymentProfiles -AssignmentReason { param($item) $item.AssignmentReason }
4585+
Add-ExportData -ExportData $exportData -Category "Enrollment Status Page" -Items $relevantPolicies.ESPProfiles -AssignmentReason { param($item) $item.AssignmentReason }
45704586
Add-ExportData -ExportData $exportData -Category "Endpoint Security - Antivirus" -Items $relevantPolicies.AntivirusProfiles -AssignmentReason { param($item) $item.AssignmentReason }
45714587
Add-ExportData -ExportData $exportData -Category "Endpoint Security - Disk Encryption" -Items $relevantPolicies.DiskEncryptionProfiles -AssignmentReason { param($item) $item.AssignmentReason }
45724588
Add-ExportData -ExportData $exportData -Category "Endpoint Security - Firewall" -Items $relevantPolicies.FirewallProfiles -AssignmentReason { param($item) $item.AssignmentReason }
@@ -4833,8 +4849,8 @@ do {
48334849
}
48344850
else { $_.Reason }
48354851
}
4836-
$profile | Add-Member -NotePropertyName 'AssignmentSummary' -NotePropertyValue ($assignmentSummary -join "; ") -Force
4837-
$allPolicies.DeploymentProfiles += $profile
4852+
$policyProfile | Add-Member -NotePropertyName 'AssignmentSummary' -NotePropertyValue ($assignmentSummary -join "; ") -Force
4853+
$allPolicies.DeploymentProfiles += $policyProfile
48384854
}
48394855

48404856
# Get Enrollment Status Page Profiles
@@ -5560,8 +5576,8 @@ do {
55605576
foreach ($policyProfile in $autoProfilesAU) {
55615577
$assignments = Get-IntuneAssignments -EntityType "windowsAutopilotDeploymentProfiles" -EntityId $policyProfile.id
55625578
if ($assignments | Where-Object { $_.Reason -eq "All Users" }) {
5563-
$profile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue "All Users" -Force
5564-
$allUsersAssignments.DeploymentProfiles += $profile
5579+
$policyProfile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue "All Users" -Force
5580+
$allUsersAssignments.DeploymentProfiles += $policyProfile
55655581
}
55665582
}
55675583

@@ -6002,8 +6018,8 @@ do {
60026018
foreach ($policyProfile in $autoProfilesAD) {
60036019
$assignments = Get-IntuneAssignments -EntityType "windowsAutopilotDeploymentProfiles" -EntityId $policyProfile.id
60046020
if ($assignments | Where-Object { $_.Reason -eq "All Devices" }) {
6005-
$profile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue "All Devices" -Force
6006-
$allDevicesAssignments.DeploymentProfiles += $profile
6021+
$policyProfile | Add-Member -NotePropertyName 'AssignmentReason' -NotePropertyValue "All Devices" -Force
6022+
$allDevicesAssignments.DeploymentProfiles += $policyProfile
60076023
}
60086024
}
60096025

0 commit comments

Comments
 (0)