[ A U T O P I L O T   C L E A N U P ]

Bulk device cleanup across Autopilot, Intune, and Entra ID.

Remove devices from all three services in one workflow — with PowerShell.

Install Now GitHub
v2.1.0 · PowerShell 7.0+

Features

Everything you need to clean up stale and decommissioned devices.

🗑

Multi-Service Cleanup

Remove devices from Autopilot, Intune, and Entra ID in the correct dependency order — all in a single workflow.

🖱

Interactive Device Selection

WPF grid view with search, multi-select, and GroupTag filtering. Pick exactly the devices you want to remove.

Fast Bulk Removal

Bulk removal mode skips status checking for speed, then exports results to a CSV for review.

🔍

Serial Number Validation

Prevents accidental deletion by validating serial numbers and flagging duplicate device names.

📊

Real-Time Monitoring

Tracks deletion progress with automatic verification across all three services, with up to 30-minute monitoring.

🧪

WhatIf Mode

Preview exactly what would be deleted without making actual changes. Safe testing before real cleanup.

🔑

Custom App Registration

Optionally bring your own app registration with Configure-AutopilotCleanup. Persists across sessions via environment variables.

📦

Zero Config

Auto-installs required modules on first run. No manual setup needed — just install and go.

🔄

Auto-Updates

Automatically checks PowerShell Gallery for new versions and prompts to update with the correct install method.

See It in Action

Full device cleanup workflow — authentication, selection, and removal.

Autopilot Cleanup Demo

Screenshots

The interactive device cleanup experience.

Device Selection Grid
WPF Device Selection Grid
Device Verification
Device Verification & Action Menu
Removal Monitoring
Real-Time Removal Monitoring

How It Works

Devices are removed in the correct dependency order.

1

Authenticate

Connect to Microsoft Graph with the required scopes via browser sign-in.

2

Select Devices

Interactive WPF grid displays all Autopilot devices enriched with Intune & Entra data.

3

Remove from Intune

Management layer removed first to prevent re-enrollment conflicts.

4

Remove from Autopilot

Deployment service registration cleaned up after Intune removal.

5

Remove from Entra ID

Identity source cleaned up last, completing the full removal.

6

Verify

Monitors and confirms successful removal from all three services.

Quick Start

Up and running in two commands.

Install
Install-Module -Name AutopilotCleanup -Repository PSGallery
Run
Start-AutopilotCleanup
Optional: WhatIf Mode
# Preview deletions without making changes
Start-AutopilotCleanup -WhatIf
Optional: Custom App Registration
# Configure once, use anytime
Configure-AutopilotCleanup

Parameters

Command-line options for Start-AutopilotCleanup.

Parameter Type Description
-WhatIf Switch Preview mode — shows what would be deleted
-ClientId String Client ID of a custom app registration
-TenantId String Tenant ID for the custom app registration

API Permissions

Required Microsoft Graph delegated permissions.

Default Auth

  • Device.ReadWrite.All
  • DeviceManagementManagedDevices.ReadWrite.All
  • DeviceManagementServiceConfig.ReadWrite.All

Custom App Registration

  • Device.ReadWrite.All
  • DeviceManagementManagedDevices.ReadWrite.All
  • DeviceManagementManagedDevices.PrivilegedOperations.All
  • DeviceManagementServiceConfig.ReadWrite.All