← Back to articles Intune

Intune Remote Device Actions: Wipe, Lock, Locate & More

Intune Remote Device Actions: Wipe, Lock, Locate & More
🎬

Video Brief & Interactive Architecture Deck

Watch the walkthrough, explore the 16:9 interactive slide deck, or download PDF notes

The Scenario

We were managing roughly 4,200 endpoints across a financial services client — a mix of Windows 10/11, iOS, Android Enterprise, and a handful of macOS devices. Licensing was Microsoft 365 E3 with the Intune Plan 1 add-on. About 18 months into the engagement, a senior analyst left the organization under less-than-ideal circumstances. HR called IT at 4:47 PM on a Friday afternoon. The device — a corporate-owned Windows 11 laptop — was at home with the user. No physical retrieval was possible before the weekend.

What followed was a scramble that exposed exactly how poorly most teams understand what remote device actions actually do, when they do it, and — critically — what happens when the device isn't online at the moment you pull the trigger. We had to make a call: Wipe or Retire? Did the device have BitLocker enabled? Would the wipe be immediate or queued? Could we locate it? What was the audit trail?

Over the next 72 hours, and in the months of process hardening that followed, we built a much more rigorous understanding of Intune's remote action framework. This post is the documentation we wish had existed before that Friday.

Why This Matters

Remote device actions are one of those features that everyone assumes they understand until they're under pressure and something doesn't behave as expected. The stakes are real: data loss, compliance failures, litigation hold violations, and reputational damage can all flow from a misexecuted remote action — or one that never executed at all.

What the official Microsoft documentation covers is the what. It tells you a Wipe resets the device to factory defaults, that Retire removes company data, that you can lock a device remotely. What it doesn't adequately convey is:

  • Actions are queued, not instant. If the device is offline, the action sits pending. The device must check in to execute it. On Windows, this happens via the Windows Push Notification Service (WNS). On iOS, it's APNs. If those channels are disrupted or the device never comes back online, the action may never fire.
  • Wipe and Retire have materially different compliance and legal implications. In a litigation hold scenario, wiping a device before legal review can constitute spoliation of evidence. Your legal team needs to be part of this workflow.
  • Not all actions are available on all platforms. The Locate Device action, for example, requires the device to be supervised on iOS, and on Windows it requires the Intune Management Extension plus location permissions. Most deployments don't have this configured until they need it — at which point it's too late.
  • The audit log is your only post-hoc record, and it doesn't capture device state at the time the action was issued. If you need to prove what was on the device before the wipe, you needed to capture that data beforehand through another mechanism.

From a compliance standpoint, organizations under HIPAA, PCI-DSS, or SOC 2 frameworks often have specific requirements around data destruction documentation. Intune's audit logs satisfy some of this, but not all of it without supplementary tooling.

Root Cause Analysis

How Remote Actions Actually Work Under the Hood

When you issue a remote action from the Intune portal — or via Graph API — Intune creates a device action request stored in the Intune backend. The action state transitions through several stages: pending, sent, active, and either done or failed. The device doesn't receive the command directly from the portal click. Instead, Intune sends a push notification to wake the device's MDM client, which then polls the Intune service to retrieve pending commands.

On Windows, this wake signal goes through WNS. The device's DMClient (the Windows MDM agent) then contacts the Intune MDM endpoint, retrieves the SyncML command payload, and executes locally. The result is reported back on the next check-in cycle, which can be up to 8 hours under normal polling intervals — though the push notification typically shortens this to minutes when the device is online and reachable.

On iOS and iPadOS (supervised), APNs delivers the wake signal. On Android Enterprise, FCM (Firebase Cloud Messaging) handles it. Each of these external dependencies introduces a potential failure point that Intune itself has no control over.

Investigating Action Status via Graph API

The portal gives you a status indicator, but if you're troubleshooting or need to automate monitoring, Graph API is where you go. The managed device actions endpoint exposes current and historical action state:

GET https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{deviceId}/deviceActionResults

This returns an array of action results. Each result object includes actionName, actionState, startDateTime, and lastUpdatedDateTime. Here's a PowerShell snippet to pull this for a specific device by serial number, which is often how you're searching in an incident scenario:

# Requires: Microsoft.Graph PowerShell SDK or manual token acquisition
# Connect-MgGraph -Scopes "DeviceManagementManagedDevices.Read.All"

$serialNumber = "C02XG2JHJGH5"

$device = Get-MgDeviceManagementManagedDevice -Filter "serialNumber eq '$serialNumber'" -Select "id,deviceName,managedDeviceOwnerType,actionState"

if ($device) {
    $deviceId = $device.Id
    Write-Host "Found device: $($device.DeviceName) | ID: $deviceId"
    
    $actionResults = Invoke-MgGraphRequest -Method GET `
        -Uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/$deviceId/deviceActionResults"
    
    $actionResults.value | ForEach-Object {
        [PSCustomObject]@{
            Action       = $_.actionName
            State        = $_.actionState
            StartTime    = $_.startDateTime
            LastUpdated  = $_.lastUpdatedDateTime
        }
    } | Format-Table -AutoSize
} else {
    Write-Warning "No device found with serial: $serialNumber"
}

In our Friday incident, this query revealed the Wipe action had been sitting in pending state for over 14 hours. The device never came back online that weekend. When it did check in on Monday morning — after the user apparently tried to connect to update something — the wipe executed immediately. That's the expected behavior, but it's unsettling if you don't understand the queuing model.

Understanding Wipe vs. Retire vs. Fresh Start vs. Autopilot Reset

These four actions are not interchangeable, and conflating them leads to real problems. Here's the practical breakdown:

  • Wipe: Factory reset. Removes everything. On Windows, you can optionally retain enrollment state and user account for re-enrollment. On corporate-owned devices, this is typically your nuclear option. BitLocker keys are rotated post-wipe if BitLocker is enforced by policy.
  • Retire: Removes corporate data and unenrolls the device from Intune. On personally-owned (BYOD) devices, this is the appropriate action — it leaves personal data intact. On corporate-owned devices, Retire often leaves a partially configured device that can be confusing to end users.
  • Fresh Start (Windows only): Reinstalls Windows, removing installed apps, while optionally keeping user data and device enrollment. Useful for malware remediation without full data destruction.
  • Autopilot Reset (Windows only): Resets the device to a business-ready state while keeping it enrolled in Azure AD and Intune. This is the fastest path back to productivity for a device being reassigned. It does not remove the device from Autopilot or Azure AD.

The Solution

Building a Remote Action Runbook

After the Friday incident, we built a formal runbook for remote device actions. The goal was to eliminate the hesitation and confusion that happens under pressure. Here's the core of what we implemented:

Step 1: Pre-Action Checklist Script

Before issuing any destructive action, this script captures current device state to a SharePoint list via Graph API. This gives you a defensible record of device configuration at the time of the action.

# Pre-wipe device state capture
# Run this BEFORE issuing the wipe action

param(
    [Parameter(Mandatory=$true)]
    [string]$DeviceId,
    [Parameter(Mandatory=$true)]
    [string]$TicketNumber
)

$deviceInfo = Invoke-MgGraphRequest -Method GET `
    -Uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/$DeviceId?`$select=deviceName,serialNumber,operatingSystem,osVersion,lastSyncDateTime,encryptionState,complianceState,enrolledDateTime,userDisplayName,userPrincipalName"

$snapshot = [PSCustomObject]@{
    TicketNumber        = $TicketNumber
    CaptureTime         = (Get-Date -Format "o")
    DeviceName          = $deviceInfo.deviceName
    SerialNumber        = $deviceInfo.serialNumber
    OS                  = $deviceInfo.operatingSystem
    OSVersion           = $deviceInfo.osVersion
    LastSync            = $deviceInfo.lastSyncDateTime
    EncryptionState     = $deviceInfo.encryptionState
    ComplianceState     = $deviceInfo.complianceState
    EnrolledDate        = $deviceInfo.enrolledDateTime
    AssignedUser        = $deviceInfo.userDisplayName
    UPN                 = $deviceInfo.userPrincipalName
}

# Export to CSV as audit record
$snapshot | Export-Csv -Path "C:\DeviceActionAudit\$TicketNumber-$($deviceInfo.serialNumber)-pre-action.csv" -NoTypeInformation
Write-Host "Pre-action snapshot captured for $($deviceInfo.deviceName)" -ForegroundColor Green
$snapshot | Format-List

Step 2: Issuing the Wipe via Graph API

For documented, auditable wipes we issue the action via Graph API rather than the portal. This creates a cleaner audit trail tied to a service account and makes it scriptable for bulk operations.

# Issue Wipe action via Graph API
# keepEnrollmentData: $false for full wipe, $true for re-enrollment scenarios
# keepUserData: only relevant when keepEnrollmentData is $true

param(
    [Parameter(Mandatory=$true)]
    [string]$DeviceId,
    [bool]$KeepEnrollmentData = $false,
    [bool]$KeepUserData = $false
)

$body = @{
    keepEnrollmentData = $KeepEnrollmentData
    keepUserData       = $KeepUserData
    useProtectedWipe   = $true  # Requires confirmation on the device before wipe completes (iOS)
} | ConvertTo-Json

try {
    Invoke-MgGraphRequest -Method POST `
        -Uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/$DeviceId/wipe" `
        -Body $body `
        -ContentType "application/json"
    Write-Host "Wipe action issued successfully for device ID: $DeviceId" -ForegroundColor Yellow
    Write-Warning "Monitor action status. Device must check in for wipe to execute."
} catch {
    Write-Error "Failed to issue wipe: $_"
}

Step 3: Monitor Action Completion

Rather than manually refreshing the portal, we use a polling loop with alerting. In production this runs as an Azure Automation runbook that posts to a Teams channel when the action state changes.

# Poll device action status until completion or timeout
param(
    [string]$DeviceId,
    [string]$ActionName = "wipe",
    [int]$TimeoutMinutes = 240,
    [int]$PollIntervalSeconds = 60
)

$deadline = (Get-Date).AddMinutes($TimeoutMinutes)
$completed = $false

while ((Get-Date) -lt $deadline -and -not $completed) {
    $results = Invoke-MgGraphRequest -Method GET `
        -Uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/$DeviceId/deviceActionResults"
    
    $targetAction = $results.value | 
        Where-Object { $_.actionName -eq $ActionName } | 
        Sort-Object startDateTime -Descending | 
        Select-Object -First 1
    
    if ($targetAction) {
        $state = $targetAction.actionState
        Write-Host "[$(Get-Date -Format 'HH:mm:ss')] Action state: $state"
        
        if ($state -in @("done", "failed")) {
            $completed = $true
            if ($state -eq "done") {
                Write-Host "Action completed successfully." -ForegroundColor Green
            } else {
                Write-Warning "Action failed. Review device logs and retry."
            }
        }
    }
    
    if (-not $completed) {
        Start-Sleep -Seconds $PollIntervalSeconds
    }
}

if (-not $completed) {
    Write-Warning "Timeout reached. Action still pending. Device may be offline."
}

For full reference on available remote actions and their platform support matrix, see the Microsoft Learn documentation on remote actions.

Locate Device Configuration Requirements

The Locate Device action is frequently misconfigured or simply not tested until it's needed. On iOS, the device must be supervised. On Windows, the Allow Location setting must be enabled via a device configuration profile, and the device must have the Intune Management Extension installed. We deploy this configuration proactively:

// Device Configuration Profile - Windows Location Policy
// OMA-URI: ./Vendor/MSFT/Policy/Config/System/AllowLocation
// Data type: Integer
// Value: 1 (Allow)

// Deploy this to all corporate-owned Windows devices as a baseline.
// Without this, Locate Device will return an error regardless of the device's
// physical GPS capability.

More details on platform-specific requirements are documented in the Locate lost or stolen devices with Intune reference.

Scaling Considerations

At 4,200 devices, the individual action model works. At 10,000+ devices, the operational patterns change significantly.

Bulk actions have throttling limits. Graph API enforces throttling on the deviceManagement endpoint. If you're scripting bulk wipes — say, during a large-scale hardware refresh — you'll hit HTTP 429 responses. Implement retry logic with exponential backoff. In our experience, issuing more than 50 device actions per minute reliably triggers throttling.

Action state tracking at scale requires a database, not a spreadsheet. We moved from CSV exports to an Azure SQL table that gets updated by the polling runbook. This allows querying by action state, device platform, enrolled date, or assigned user — critical when you're tracking 200+ pending wipes across a refresh cycle.

Stale device cleanup complicates action reliability. Devices that haven't checked in for 90+ days will almost certainly never execute a queued action. Build a process to identify and handle these separately. We use a 30-day no-check-in threshold to flag devices for manual follow-up before issuing remote actions against them.

# Find devices that haven't checked in for 30+ days
$cutoff = (Get-Date).AddDays(-30).ToString("o")

$staleDevices = Invoke-MgGraphRequest -Method GET `
    -Uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?`$filter=lastSyncDateTime le $cutoff&`$select=id,deviceName,lastSyncDateTime,userPrincipalName,operatingSystem" `
    -OutputType PSObject

$staleDevices.value | 
    Select-Object deviceName, userPrincipalName, operatingSystem, lastSyncDateTime | 
    Sort-Object lastSyncDateTime | 
    Format-Table -AutoSize

RBAC matters more than you think at scale. The built-in Intune Help Desk Operator role can issue remote lock but cannot issue wipe. If your service desk team needs wipe capability, you're looking at a custom RBAC role. Design this carefully — wipe is irreversible and should have a narrower blast radius in terms of who can trigger it. See Intune role-based access control documentation for the permission mapping.

Lessons Learned

  • Test every remote action before you need it in production. Seriously — set up a test device and run through Wipe, Retire, Lock, and Locate Device in a non-emergency context. Understand what the device experience looks like and how long each action takes. This knowledge is invaluable when you're on the phone with an executive at 5 PM.
  • Retire is almost always the right action for BYOD devices; Wipe is almost always wrong. Wiping a personally-owned device that has personal photos, banking apps, and contacts on it is a liability and a trust-destroyer. The policy enforcement around this needs to exist before an incident, not during one. Document it in your acceptable use policy.
  • The pending state is not a failure — but it requires active monitoring. An action sitting in pending for 48 hours is not an Intune bug. It means the device is offline. Your process needs to account for what happens if the device never comes back online — do you escalate to physical retrieval? Contact the carrier to flag the SIM? Have a decision tree ready.
  • BitLocker key escrow should be verified before you need to wipe. After a wipe, BitLocker keys are rotated. But if the device was encrypted before enrollment, or if key escrow failed silently, you may have unencrypted data sitting on a device you can't physically access. Audit BitLocker key escrow status regularly as part of your compliance baseline.
  • The Intune audit log is essential but incomplete. The audit log captures who issued the action and when, but not device state at time of action. Supplement it with your own pre-action snapshots. If you ever need to demonstrate to an auditor or legal team exactly what was on a device before it was wiped, that data has to come from somewhere — and it won't come from Intune alone.

Was this article helpful?

🎯
MSEndpoint Academy · MD-102

Assess Your Microsoft 365 & Intune Skills (MD-102)

100% Free • 10 Real Questions

Applying this guide in production? Test your technical readiness against real exam scenarios from Microsoft 365 Certified: Endpoint Administrator (MD-102).

💡 MD-102 Express Knowledge Check · Official Question

During Windows Autopilot user-driven Microsoft Entra join, you need to prevent standard users from getting local Administrator rights on newly provisioned Windows 11 PCs. Where should you configure this?

MSEndpoint Academy Realistic Simulator Tour
▶
🎬 2-MIN SIMULATOR TOUR
⚡ Stop Failing on Pearson VUE Case Studies
See Real Split-Screen Case Studies, Mistake Drills & 1:1 Live Coaching in Action
  • 3-Question Linked Case Studies + Interactive Hotspots
  • Retry Failed Questions with verified Microsoft Learn deep links
  • 1-on-1 Certified Architect Coaching & Enterprise Team Passes
🔒 100% Free • 📊 Instant Explanations • 🖥️ Pearson VUE Mode
Take Free 10-Question MD-102 Diagnostic → MD-102 2026 Exam Guide & Sample Q&A Launch Pearson VUE Simulator
🎁 Free Community Automation Hub

Functional Automation & Blueprints

Production-ready scripts, GitHub repositories, and architectural blueprints created for this technical guide.

PowerShell, Microsoft Graph, Microsoft Intune
AUTOMATION TOOLKIT

Intune Device Action Status Checker via Microsoft Graph

Queries Microsoft Graph to retrieve pending and historical remote device action results for a specific Intune-managed device identified by serial number.

Star on GitHub Download .ps1
💡 Enterprise Blueprint
HIGH IMPACT

IntuneActionGuard

A decision-engine and audit toolkit that guides IT admins through high-stakes Intune remote device actions with pre-flight checks, queued-action monitoring, and compliance-ready audit trails.

🤝 Custom Build
💡 Enterprise Blueprint
HIGH IMPACT

IntuneActionGuard

A pre-flight checklist and audit dashboard that prevents costly mistakes when executing Intune remote device actions under pressure.

🤝 Custom Build

🎓 Ready to go deeper on MD-102?

Practice real MD-102 exam questions, study verified Microsoft Learn explanations, and test yourself in Pearson VUE simulator mode.

Free 10Q MD-102 Exam → Launch Simulator 📚 Study Guides (20 Domains) ⚖️ vs MeasureUp
📡

Don't miss the Friday Microsoft Endpoint & Security TV Digest

One email a week: the Intune, Entra & Windows changes that actually matter, the Alex & Sarah TV episode, and new production-ready PowerShell scripts. No spam, unsubscribe in one click.

Browse past TV episodes & issues →
Souhaiel Morhag
Souhaiel Morhag
Microsoft Endpoint & Modern Workplace Engineer

Souhaiel Morhag is a Microsoft Intune and endpoint management specialist with hands-on experience deploying and securing enterprise environments across Microsoft 365. He founded MSEndpoint.com to share practical, real-world guides for IT admins navigating Microsoft technologies — and built the MSEndpoint Academy at app.msendpoint.com/academy, a dedicated learning platform for professionals preparing for the MD-102 (Microsoft 365 Endpoint Administrator) certification. Through in-depth articles and AI-powered practice exams, Souhaiel helps IT teams move faster and certify with confidence.

Related Articles

Popular on MSEndpoint