--- title: "Bulk Trigger Intune Device Diagnostics Collection" slug: "dex-wf-bulk-intune-diagnostics-collection" updated: 2026-11-30T16:14:57Z published: 2026-11-30T16:14:57Z canonical: "documentation.sysaid.com/dex-wf-bulk-intune-diagnostics-collection" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.sysaid.com/llms.txt > Use this file to discover all available pages before exploring further. # Bulk Trigger Intune Device Diagnostics Collection Remotely collect diagnostic logs from managed devices in Microsoft Intune by sending the log collection action to many devices through Microsoft Graph. **Complexity:** Intermediate. **Impact:** bulk-operation + device-management + troubleshooting + privileged-action. ## Why use this workflow When you troubleshoot a fleet-wide issue, such as a failing configuration profile, a compliance regression after an OS update, or a suspected MDM agent problem, you often need diagnostic logs from many devices at once. Intune exposes a per-device `createDeviceLogCollectionRequest` action that triggers the MDM agent to upload a log bundle to Intune, where you can download it as a ZIP for analysis. The Intune admin center lets you trigger this action one device at a time, which is impractical for tenants with many devices. This workflow shows how to fan the action out across your managed device estate (or a filtered subset) using Microsoft Graph. ### When to run this workflow - A widespread issue is reported and you need diagnostic data from many devices for root-cause analysis - You are preparing a Microsoft support case and need logs from a representative device sample - You want to verify MDM agent health across the fleet after a major configuration change - A compliance policy is failing unexpectedly on multiple devices ## Expected outcomes - A log collection request queued against every targeted managed device in Intune - A CSV or JSON record of which devices were requested, skipped, or failed - Diagnostic log ZIP bundles downloadable from the Intune admin center once devices check in (platform coverage varies) - A repeatable script you can rerun against filtered device sets (by OS, compliance state, group membership, and so on) Devices upload logs on their next MDM check-in. You can also trigger a sync action to shorten the wait. ## Risks and considerations ### Operational risks - **Network load on endpoints:** Each device uploads a diagnostic bundle. Running this against many devices at once can produce a spike in outbound traffic from client networks. - **Platform coverage is uneven:** `createDeviceLogCollectionRequest` is supported on Windows 10 and 11 MDM-enrolled devices. Support on macOS, iOS, and Android is limited or requires the device to be corporate-owned or supervised. Unsupported devices return errors. Expect these and do not treat them as failures. - **Offline devices:** The request queues until the device next checks in. Devices that never check in (retired, lost) show a pending request indefinitely. - **Throttling:** Microsoft Graph enforces per-tenant and per-app throttling. For large fleets, pace the requests (small batches with a short delay) to avoid HTTP 429 responses. ### Privacy and compliance - Diagnostic logs may contain user names, device names, installed app inventory, and event log excerpts. Treat the downloaded bundles as confidential and store them according to your data retention policy. - In jurisdictions with works councils or strict privacy controls, confirm that bulk log collection is permitted before running. - Do not leave collected logs in admin mailboxes or shared drives. Delete them after the investigation is complete. ### What not to do - Do not run this against your entire fleet as a routine health check. It is an on-demand troubleshooting tool. - Do not skip the targeting review step. A typo in a filter can target the wrong population. ## Required permissions | Permission | Why it's needed | | --- | --- | | DeviceManagementManagedDevices.Read.All | Required to enumerate managed devices and read their metadata (OS, enrollment state) for targeting. | | DeviceManagementManagedDevices.PrivilegedOperations.All | Required to invoke the createDeviceLogCollectionRequest action. This is a privileged device management operation. | ## Ask Dex Paste the prompt into a Dex conversation. ### Prompt for IT admins ``` Trigger an Intune diagnostics log collection on all managed devices matching {filter} (e.g. operatingSystem eq 'Windows' and complianceState eq 'nonCompliant'). Show me the targeted count first, confirm before proceeding, then fan out the createDeviceLogCollectionRequest action and report per-device success/failure. ``` ## Manual steps (admin center) The Intune admin center does not support a bulk collect diagnostics action. You trigger it on each device individually. Use this path for a small number of devices. For larger fleets, use the Graph API or PowerShell approach. ### Per-device procedure 1. Sign in to the [Microsoft Intune admin center](https://intune.microsoft.com) with an account that has the *Intune Administrator* or *Help Desk Operator* role. 2. Go to **Devices** > **All devices**. 3. Use the filter bar to narrow the list (for example, OS = Windows, Compliance = Not compliant) and locate the target device. 4. Click the device name to open its overview. 5. In the action bar at the top, click **Collect diagnostics**. On macOS the action may be labeled **Collect logs**. 6. Confirm the action in the prompt. The request is queued and the device uploads logs on its next check-in. 7. To retrieve the logs, wait for the request status to change to *Complete*, then go to **Devices** > **Monitor** > **Device diagnostics** and click **Download** on the relevant entry. ### Tracking bulk requests After you trigger many requests with a script or the API, you can review their status centrally under **Devices** > **Monitor** > **Device diagnostics**. This view shows pending and completed collection requests across the tenant, with download links for completed bundles. ## Microsoft Graph API Two endpoints are involved: one to enumerate devices and one to trigger the collection. ### Step 1: Enumerate target devices ``` GET https://graph.microsoft.com/beta/deviceManagement/managedDevices?$select=id,deviceName,operatingSystem,complianceState&$filter=operatingSystem eq 'Windows' ``` Use `$filter` to narrow the targeting (by OS, compliance state, enrollment type, and so on) and `$select` to keep payloads small. The endpoint is paginated. Follow `@odata.nextLink` until it is absent. **Sample response:** ``` {  "value": [    {      "id": "9f420691-1c67-4b46-b154-0e1b1342f4c4",      "deviceName": "DESKTOP-EXOTIC-891",      "operatingSystem": "Windows",      "complianceState": "nonCompliant"    }  ],  "@odata.nextLink": "https://graph.microsoft.com/beta/deviceManagement/managedDevices?$skiptoken=..." } ``` ### Step 2: Trigger diagnostics collection for each device ``` POST https://graph.microsoft.com/beta/deviceManagement/managedDevices/{managedDeviceId}/createDeviceLogCollectionRequest Content-Type: application/json {  "templateType": "predefined" } ``` **Response:** HTTP `200 OK` with an empty body on success. A `400` typically means the device platform does not support the action. A `404` means the device ID is stale. ### Step 3: Check request status (optional) ``` GET https://graph.microsoft.com/beta/deviceManagement/managedDevices/{managedDeviceId}/logCollectionRequests ``` Returns an array of past and pending requests with `status` (*pending*, *completed*, *failed*) and, for completed requests, a URL to download the log bundle. ### Throttling guidance - Limit concurrency to a small number of parallel POST requests. - Retry on HTTP 429 using the `Retry-After` header. ## PowerShell The approach uses the `Microsoft.Graph.Beta.DeviceManagement` module to enumerate devices, optionally filter them, and send `createDeviceLogCollectionRequest` calls in batches with throttle handling. ### Prerequisites - PowerShell 7 or later (recommended) or Windows PowerShell 5.1 - Microsoft Graph PowerShell SDK: `Install-Module Microsoft.Graph.Beta -Scope CurrentUser` - A signed-in account with the *Intune Administrator* role or equivalent ### Connect ``` Connect-MgGraph -Scopes "DeviceManagementManagedDevices.PrivilegedOperations.All","DeviceManagementManagedDevices.Read.All" ``` ### Approach 1. Enumerate managed devices with optional filters (OS, compliance state, device name pattern). 2. Show a summary table of the targeted devices and ask for confirmation before sending any request. Use a preview mode first. 3. Send the POST requests with a concurrency cap and automatic retry on HTTP 429. 4. Write a CSV log of successes and failures. After the run, monitor progress under **Devices** > **Monitor** > **Device diagnostics** in the Intune admin center and download the log bundles as each device checks in.