← Back to articles Intune

Device Query for Multiple Devices in Intune Advanced Analytics

Device Query for Multiple Devices in Intune Advanced Analytics
🎬

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 Windows endpoints across a hybrid environment — a mix of Entra-joined workstations, co-managed laptops still running SCCM client workloads, and a tail of legacy devices that finance refused to retire. The organization had recently acquired the Intune Suite add-on, which unlocked Advanced Analytics and, with it, the Device Query capability that most teams had only seen in Microsoft demos.

The trigger was a vendor advisory: a specific version of a third-party VPN client was causing memory leaks under Windows 11 23H2. Security wanted a list of affected devices within the hour. The old workflow — exporting from Intune, pivoting in Excel, cross-referencing with our CMDB — would have taken half a day. We needed something faster, and we already had the license sitting there. That's when Device Query for multiple devices stopped being a curiosity and became a production tool.

Within 20 minutes of writing our first cross-fleet KQL query, we had a precise list of 847 affected devices, their primary users, last check-in times, and installed VPN client versions. That result changed how our team operates day-to-day.

Why This Matters

The traditional Intune reporting model is pull-based and aggregated. You get what Microsoft decided to surface in the portal. Hardware inventory, software inventory, compliance state — all useful, but always at arm's length from the raw data. Device Query changes the model entirely: you're running live queries against the device, not against a cached reporting snapshot that might be 24–72 hours stale.

When you scale that to multiple devices simultaneously using the multi-device query feature in Advanced Analytics, you're effectively building an ad-hoc fleet intelligence capability without standing up any additional infrastructure. No SCCM, no Log Analytics workspace with custom agents, no PowerShell remoting with firewall exceptions. The query runs through the existing Intune management channel.

What the official docs don't tell you:

  • The multi-device query feature has a practical ceiling that differs from the documented limit depending on device responsiveness and your tenant's query throttling behavior. We'll cover this in the scaling section.
  • Results are not guaranteed to be synchronous for all devices. The query fans out and devices respond as they check in — this is critical for incident response timing expectations.
  • The licensing requirement is not just Intune Plan 2 or Intune Suite — devices themselves must have the Advanced Analytics component activated, which requires a separate assignment step that is easy to miss during suite onboarding.
  • KQL in Device Query is a subset of full KQL. Several operators that work in Log Analytics will silently fail or return unexpected results here. Testing in a small device group before fleet-wide execution is not optional.

From a security posture standpoint, the ability to query installed software versions, running processes, loaded drivers, or registry values across your entire fleet in near real-time is the kind of visibility that previously required EDR tooling. It doesn't replace EDR — but it closes a real gap for organizations that need fast answers without waiting on a SIEM pipeline.

Root Cause Analysis

How Multi-Device Query Actually Works

Understanding the architecture matters when you're troubleshooting query failures or unexpected result gaps. Device Query leverages the Intune Management Extension (IME) as the on-device agent. The IME maintains a persistent channel to the Intune service and, when a query is dispatched, it receives the KQL payload, executes it locally using a sandboxed query engine, and returns results through the same channel.

For single-device query, this is straightforward. For multi-device query, the Intune service fans the query out to all targeted devices simultaneously. Devices that are online and have a live IME connection respond within seconds. Devices that are offline, sleeping, or have a disrupted IME connection are queued — but the query itself has a result window. Once that window closes, you get whatever came back.

The tables available to query are not arbitrary. They map to specific data providers registered within the IME. The current production table catalog includes, among others:

  • DeviceInfo — OS version, build, architecture, join type
  • InstalledApplications — installed Win32 and store apps with publisher and version
  • Certificates — certificate store contents including thumbprint, issuer, expiry
  • LocalGroups and LocalGroupMembers — local admin group membership (critical for compliance)
  • Drivers — driver version, provider, and signing status
  • Services — service state, start type, binary path
  • Processes — running process list at query execution time
  • RegistryKeys and RegistryValues — targeted registry inspection

The query engine on-device runs in a restricted context. It cannot modify state, execute commands, or access user profile data outside of what the IME process has permission to read. This is a security boundary by design — Device Query is read-only.

Licensing and Activation Pitfall

We hit this hard during rollout. The Intune Suite license was assigned to users, Advanced Analytics was enabled at the tenant level, but multi-device query was returning empty results for about 30% of our fleet. After opening a support case and two hours of back-and-forth, the answer was: Advanced Analytics requires an explicit feature assignment policy pushed to devices. Simply having the license in the tenant isn't enough. The feature must be enabled via the Intune portal under Reports > Advanced Analytics > Settings, and it propagates through a policy that devices must receive and apply.

Devices that hadn't checked in since we enabled the feature — or had IME issues — were simply not enrolled in the query capability even though they appeared healthy in the Intune console. We validated this by checking IME logs:

# Check IME log for Advanced Analytics enrollment status
$imePath = "$env:ProgramData\Microsoft\IntuneManagementExtension\Logs\IntuneManagementExtension.log"
Get-Content $imePath | Select-String -Pattern "AdvancedAnalytics|DeviceQuery|QueryEngine" | Select-Object -Last 50

Devices that were properly enrolled showed entries confirming the query engine component initialized successfully. Devices that weren't showed nothing — the capability simply wasn't loaded.

Graph API Investigation

While the portal UI is the primary interface for Device Query, understanding the underlying Graph API calls helps when you need to automate result retrieval or integrate with other tooling. Multi-device query operations flow through the deviceManagement/deviceHealthScripts and analytics endpoints. You can inspect active queries and their result status:

# Authenticate and retrieve Advanced Analytics query results via Graph
$headers = @{
    "Authorization" = "Bearer $accessToken"
    "Content-Type"  = "application/json"
}

# List recent device query runs
$uri = "https://graph.microsoft.com/beta/deviceManagement/reports/cachedReportConfigurations"
$response = Invoke-RestMethod -Uri $uri -Headers $headers -Method GET
$response.value | Where-Object { $_.id -like "*DeviceQuery*" } | Select-Object id, status, lastRefreshDateTime

This endpoint isn't fully documented in the public reference yet, but it's stable enough in production. The status field tells you whether a query is still collecting results or has finalized — important context when you pull results programmatically and need to know if you're seeing a complete picture.

The Solution

Building an Effective Multi-Device Query Workflow

Navigating to Devices > Advanced Analytics > Device query in the Intune portal, you'll see the option to target a device group rather than a single device. The query editor is the same KQL interface, but results are aggregated across all responding devices with an additional DeviceName column prepended automatically.

Here are production-tested queries we use regularly:

1. Find all devices with a specific application installed and its version:

InstalledApplications
| where Name contains "Cisco AnyConnect"
| project DeviceName, Name, Version, Publisher, InstallDate
| order by Version asc

2. Identify devices where a specific service is stopped when it should be running:

Services
| where Name == "WinDefend" and State != "Running"
| project DeviceName, Name, State, StartType, Description

3. Check for unauthorized local administrators across the fleet:

LocalGroupMembers
| where GroupName == "Administrators"
| where MemberName !in ("Domain Admins", "BUILTIN\\Administrator", "YourExpectedAdminAccount")
| project DeviceName, GroupName, MemberName, MemberType
| order by DeviceName asc

4. Driver version audit for a specific driver:

Drivers
| where DriverProvider contains "Intel"
| where Class == "Net"
| project DeviceName, DriverName, DriverVersion, DriverProvider, IsSigned
| order by DriverVersion asc

5. Certificate expiry audit — find certs expiring in the next 30 days:

Certificates
| where ExpiryDate <= ago(-30d)
| where StoreLocation == "LocalMachine"
| project DeviceName, Subject, Issuer, ExpiryDate, Thumbprint
| order by ExpiryDate asc

Exporting and Acting on Results

The portal allows CSV export of multi-device query results, but for operational workflows you want something repeatable. We built a lightweight wrapper that authenticates, executes a predefined query against a named device group, waits for result completion, and drops the CSV to a SharePoint library for the service desk team:

# Simplified Device Query automation wrapper
# Requires: MSAL.PS module, appropriate Graph permissions

Import-Module MSAL.PS

$tenantId     = "your-tenant-id"
$clientId     = "your-app-registration-client-id"
$clientSecret = "your-client-secret" | ConvertTo-SecureString -AsPlainText -Force

$token = Get-MsalToken -TenantId $tenantId -ClientId $clientId -ClientSecret $clientSecret `
         -Scopes "https://graph.microsoft.com/.default"

$headers = @{
    "Authorization" = "Bearer $($token.AccessToken)"
    "Content-Type"  = "application/json"
}

# Submit query (adapt groupId and KQL as needed)
$queryBody = @{
    query   = "InstalledApplications | where Name contains 'VulnerableApp' | project DeviceName, Version"
    groupId = "your-aad-group-id"
} | ConvertTo-Json

$submitUri = "https://graph.microsoft.com/beta/deviceManagement/deviceQueryResults"
$result    = Invoke-RestMethod -Uri $submitUri -Headers $headers -Method POST -Body $queryBody

Write-Output "Query submitted. Result ID: $($result.id)"
# Poll for completion and retrieve results
# (implement polling loop with status check against result.id)

Note: The Graph beta endpoint for device query submission is under active development. Always test after major Intune service updates. The official multi-device query documentation is the canonical reference for supported tables and current API shape.

Targeting Strategy

Multi-device query targets an Entra ID security group. Dynamic groups are fully supported and are the right choice for operational queries — you want "all Windows 11 devices" or "all devices in the Finance OU" to resolve dynamically rather than maintaining a static list. For incident response scenarios, create a temporary static group, add devices, query, then delete the group. This keeps your group inventory clean and the query scope tightly controlled.

For compliance-related queries that run on a schedule, we use dynamic groups with membership rules aligned to our existing Intune assignment groups. This means the query target stays in sync with device enrollment and group membership changes automatically.

Scaling Considerations

At 4,200 devices, multi-device query works well with one significant behavioral pattern to understand: result completeness is time-dependent, not guaranteed. In our testing, targeting our full fleet returns results from approximately 75–85% of devices within the first 5 minutes. The remaining 15–25% trickle in over the next 10–20 minutes as devices with intermittent connectivity or longer check-in cycles respond.

For security incident queries where you need fast answers, this is acceptable — you're getting immediate visibility into the devices that matter most (online, active devices). For compliance reporting where you need 100% coverage, you need to account for the result window and potentially re-run the query after 30–60 minutes.

At 10,000+ devices:

  • Microsoft's documented limit for multi-device query is currently scoped — check the Advanced Analytics overview for current limits as these have been expanding with service updates.
  • Query complexity matters significantly. Simple projections with a single table return fast. Joins between tables (where supported) or queries with complex where clauses with multiple string operations increase per-device execution time and can cause more devices to time out before responding.
  • Consider segmenting large fleet queries by device group to get more reliable complete results: query in groups of 2,000–3,000 devices and aggregate results externally.
  • Portal performance degrades when result sets exceed several thousand rows. Export to CSV and analyze in Excel or import to Log Analytics for large result sets.

One edge case that bit us: devices in kiosk or shared device mode with non-standard IME configurations occasionally have the query engine fail silently. These devices show as "no results" rather than "error," which is indistinguishable from a device that was offline. Build your queries to include a DeviceInfo join when you need to identify genuine non-responders versus devices that returned empty results legitimately.

For large-scale automation, be aware of Graph API throttling. If you're polling query result status in a tight loop across multiple concurrent query jobs, you'll hit 429 responses. Implement exponential backoff and respect the Retry-After header. The Microsoft Graph throttling guidance applies fully here.

Lessons Learned

  • License activation is not automatic and not obvious. After assigning Intune Suite, explicitly verify that the Advanced Analytics feature policy has been received and applied by your devices before running fleet queries. Check IME logs on a sample of devices, not just the Intune console assignment status. We lost almost two weeks of potential query capability because we assumed license assignment meant feature readiness.
  • KQL parity with Log Analytics is a trap. Engineers who know KQL from Sentinel or Azure Monitor will write queries that look correct, execute without error, and return subtly wrong results because certain operators behave differently in the Device Query engine. Always validate query logic against a known device with a known expected result before fleet-wide execution. The parse operator in particular behaves inconsistently in our testing.
  • Result completeness varies by time of day. Running fleet queries during business hours — when devices are active, connected, and the IME is running — returns significantly more complete results than queries run at night or on weekends. For scheduled compliance queries, align execution to your peak business hours in each region if you're operating globally.
  • Multi-device query is not a replacement for Endpoint Analytics or custom compliance policies for continuous monitoring. It's an on-demand investigation and audit tool. The operational model is: use Endpoint Analytics and compliance policies for continuous telemetry and alerting, use Device Query for targeted investigation when something needs immediate answers. Trying to use Device Query as a polling mechanism for ongoing monitoring is both inefficient and the wrong architecture.
  • Document your query library. The first three months after enabling this capability, queries lived in engineers' browser histories and Notepad files. After a team member left and took their institutional query knowledge with them, we built a shared OneNote library with tested queries, their purpose, expected output format, and known limitations. Treat your KQL query library as code — version control it if your team operates at that maturity level.

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.

💡 Enterprise Blueprint
HIGH IMPACT

IntuneQueryKit

Pre-built KQL query library and PowerShell runner that helps IT admins instantly interrogate their entire Intune fleet during security incidents — no KQL expertise required.

🎓 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