All scripts
Microsoft 365 448

Get-IntuneAutopilotProfileReport

Reports every Windows Autopilot deployment profile with its settings and how many registered devices are assigned to each one, useful before changing a profile that is already in use.

Get-IntuneAutopilotProfileReport.ps1
<#
.SYNOPSIS
    Reports Autopilot deployment profiles and assigned device counts.

.DESCRIPTION
    Lists every Windows Autopilot deployment profile with its key
    settings and the number of registered devices assigned to it, useful
    before changing a profile that is already actively deploying
    machines.

.EXAMPLE
    .\Get-IntuneAutopilotProfileReport.ps1

.NOTES
    Requires Microsoft.Graph.DeviceManagement.Enrollment with an active
    Connect-MgGraph session.

.AUTHOR
    Shehryar Hassan
#>

$profiles = Get-MgDeviceManagementWindowsAutopilotDeploymentProfile -All

$report = foreach ($profile in $profiles) {
    $assigned = Get-MgDeviceManagementWindowsAutopilotDeploymentProfileAssignedDevice -WindowsAutopilotDeploymentProfileId $profile.Id
    [pscustomobject]@{
        ProfileName   = $profile.DisplayName
        DeploymentMode = $profile.DeviceNameTemplate
        OOBEUserType  = $profile.OutOfBoxExperienceSetting.UserType
        AssignedDevices = $assigned.Count
    }
}

$report | Format-Table -AutoSize

Read it before you run it, and test in a safe tenant first.