HomeNewsletterCommunityToolsArchiveBlogToday's NewsAboutQuick Links Subscribe free
← Back to Blog
Intune PRTIntuneGraph APIProactive RemediationWindows HelloEntra IDReporting

Get a PRT Fleet Health Report in 5 Minutes Using Graph Explorer

IA
Imran Awan
8 July 2026

You have deployed the PRT detection script via Intune Proactive Remediation. Devices are running it. Now you want to know: how many devices in my fleet actually have a valid PRT right now? Which ones are broken? Who are the affected users? This post shows you how to pull that data out of Intune in under five minutes using Graph Explorer — no PowerShell, no app registration, no code. One query, one export, one Excel file.

Pre-requisite: You need the Intune Proactive Remediation deployed and run at least once on your devices before Graph Explorer will have results to return. If you have not deployed it yet, see the companion post on silently fixing PRT with Intune Proactive Remediations first.

Why Graph Explorer for This

Intune's built-in Proactive Remediation report in the admin centre shows you device status — compliant, non-compliant, error — but it buries the actual script output. You cannot easily see which specific check failed, what the PRT expiry date was, or whether the NGC key was set. The raw detection output is stored in Graph and is fully queryable. Graph Explorer lets you pull it directly without writing any code or registering an application.

The detection script we use writes one structured line per device in this format:

PASS|AzureAdJoined=YES|DomainJoined=YES|PRT=VALID|NGC=YES|Tenant=Contoso|Expiry=2026-07-22 09:13:02.000 UTC
FAIL|AzureAdJoined=YES|DomainJoined=YES|PRT=MISSING|NGC=NO|Tenant=Contoso|LastUpdate=

Every field is pipe-delimited, which means once you export from Graph Explorer you can split it into clean columns in Excel in about 30 seconds.

Step 1 - Open Graph Explorer and Sign In

Go to developer.microsoft.com/graph/graph-explorer and sign in with your work account. Use an account that has at least the Intune Administrator or Global Reader role.

The first time you run these queries Graph Explorer will ask you to consent to the required permission. Click Modify permissions in the left panel and ensure this permission is consented:

Permission Type Why needed
DeviceManagementScripts.Read.All Delegated Read Proactive Remediation scripts and device run states
Gotcha: If your tenant requires admin consent for Graph Explorer permissions, you will see a "Need admin approval" message. Ask your Azure AD admin to grant consent for the Graph Explorer enterprise app, or use a Global Admin account for this one-off query.

Step 2 - Find Your Proactive Remediation Script ID

Run this query to list all your Proactive Remediation scripts and find the ID of your PRT detection policy:

GET https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts

The response lists every script with its id, displayName, and lastModifiedDateTime. Look for your PRT Health Check policy and copy the id GUID.

Note: The Graph beta endpoint is required here. Proactive Remediation (deviceHealthScripts) is not yet available on the v1.0 endpoint. Beta endpoints are fully supported for production use in Intune tooling.

Step 3 - Pull All Device Run States

Replace {id} with the GUID you copied and run this query:

GET https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts/{id}/deviceRunStates?$expand=managedDevice

Each item in the value array represents one device. The fields you care about:

Field What it contains
managedDevice/deviceNameHostname
managedDevice/userPrincipalNamePrimary user UPN assigned in Intune
detectionStatesuccess (exit 0) or fail (exit 1)
preRemediationDetectionScriptOutputThe full PASS/FAIL pipe-delimited line your script wrote
remediationStateremediationNotRequired / remediationSucceeded / remediationFailed
lastStateUpdateDateTimeWhen the script last ran on this device
Watch out: If a device has never had a user logged on since the policy was assigned, it will not appear in the results at all. The detection script runs in user context, so it only fires when someone is actively signed in. Devices that have been powered off or had no interactive logon since assignment will show a gap in your report.

Step 4 - Export and Open in Excel

In Graph Explorer, click the Download button above the response panel to save the full JSON to your Downloads folder.

Open Excel and import the JSON:

  1. Go to Data - Get Data - From File - From JSON
  2. Select the downloaded JSON file
  3. In Power Query, click the value list to expand it
  4. Click Into Table, then expand the columns you want
  5. Expand managedDevice to get deviceName and userPrincipalName
  6. Click Close and Load

You now have a flat table with one row per device. Split the preRemediationDetectionScriptOutput column into columns:

  1. Select the preRemediationDetectionScriptOutput column
  2. Data - Text to Columns - Delimited - Pipe (|)
  3. This splits it into: Status, AzureAdJoined, DomainJoined, PRT, NGC, Tenant, Expiry
Tip: Filter the Status column to FAIL and you have your immediate action list. Sort by lastStateUpdateDateTime descending to put the most recently checked devices at the top.

Reading the Results

detectionState remediationState Script output What it means Action
success remediationNotRequired PASS PRT valid, all checks passed None
fail remediationSucceeded FAIL PRT was missing - remediation fixed it Monitor next run
fail remediationFailed FAIL PRT missing and could not be recovered Manual fix - sign out/in or re-join
error - ERROR Script failed to run Check device is online with active user session

Devices showing remediationFailed are your priority list. The automatic fix did not work. Common reasons: a stale Hybrid AAD join where the device registration in Entra ID has expired, or a UPN change where the cached credential no longer matches the account. Both require the user to sign out and back in, and in some cases the Hybrid AAD join scheduled task needs to re-run.

Quick Reference - The Two Graph Queries

# Step 1 - list all Proactive Remediation scripts, find your PRT script ID
GET https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts

# Step 2 - pull all device results (replace {id} with your script GUID)
GET https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts/{id}/deviceRunStates?$expand=managedDevice

References

Share this post
LinkedIn X / Twitter Reddit Bluesky

More from EndpointWeekly

Intune
Intune Certificate Profiles: SCEP, PKCS, NDES and the Full…
Certificate-based authentication in Intune — the full architecture from Root CA through…
Intune
Windows Autopilot Complete Overview: Deployment Types,…
The complete Windows Autopilot fundamentals guide: what it is, how it works, User-Driven…
Intune
Intune Win32 App Deployment: Complete Guide from Packaging to…
The complete Win32 app deployment guide: packaging with IntuneWinAppUtil, install and…