Get Microsoft Intune Status Reports with PowerShell

Get Microsoft Intune Status Reports with PowerShell

This post is a hands-on guide to generating Intune status with PowerShell — pulling a Microsoft Intune status report without ever opening the Intune admin centre. The script queries Microsoft Graph, builds a structured snapshot of devices, compliance, apps, and assignments, and outputs it as a CSV/JSON ready for further analysis or your own dashboard.

As an administrator, it is always good to keep an eye on your Intune status. In this blog I would like to show you how you can display the current Intune status with PowerShell using a small PowerShell script. The data comes straight from Microsoft Graph, so everything you see in the portal is also available programmatically.

Intune status with PowerShell output shown in a PowerShell window

How to read the Intune status with PowerShell

It really works quite easily — what you need are only 5 different graph calls to read out the status. To get the Intune status with PowerShell, let’s take a closer look at these calls:

deviceManagement/deviceCompliancePolicyDeviceStateSummary

With this call you get an output of numbers concerning the compliance state of your devices

PowerShell window showing Microsoft Intune status output
deviceManagement/managedDeviceOverview

With this call you get an output of numbers concerning the number of enrolled devices and their platform. Interesting here is that we see Linux and ChromeOs.

PowerShell script output showing Microsoft Intune status
deviceAppManagement

This graph call shows you the current status of the Windows Store for Business connector.

PowerShell window showing Intune status report output
deviceManagement/windowsAutoPilotSettings

This graph call shows you the last autopilot sync and its status

PowerShell window showing Microsoft Intune status report
deviceManagement/mobileThreatDefenseConnectors

With this query you can see the status of Windows Defender For Endpoint

Get Microsoft Intune Status Reports with PowerShell

How did I find these calls

The outstanding Browser add-on Graph X-Ray created by Eunice, Dhruv, Clement, Monica & @merill makes the finding of the needed Graph call really easy . All you have to do is install the browser add-on and switch to developer mode of your browser. Here you will get a list of all graph calls that are executed when loading a page.

Finding the Graph calls for Intune status with PowerShell

How can you get the final Script

You can find the script in my git hub repository. What you need to do is download the script and run it locally. The first time you run it you will be asked for the UPN of an administrator. Enter the UPN and authenticate yourself on your tenant.

One common pitfall is permissions: the sign-in account needs the right Microsoft Graph scopes (such as DeviceManagementManagedDevices.Read.All and DeviceManagementConfiguration.Read.All), otherwise individual calls will silently return empty results instead of an error. If a section of the report comes back blank, that missing scope is almost always the reason. A practical tip is to run the script with a least-privilege reader account first and only widen the consent if a specific call needs it, so you keep the footprint small. Because every value is pulled live from Graph, the numbers always match what the portal shows at that exact moment, which makes the output a reliable baseline for trend tracking over time.

Get Microsoft Intune Status Reports with PowerShell

After that you will get the following output:

Get Microsoft Intune Status Reports with PowerShell

Conclusion

Pulling the Intune status with PowerShell gives you a fast, repeatable snapshot of your whole environment. Of course, you can send this output every day via email or Teams, or you can develop a logic to detect if something is broken and send a notification if this is the case. It is also possible to display more connectors or other information. I hope I could explain to you with this script how you can get the Intune status with PowerShell and how you can output it.

Stay healthy, Cheers
Jannik

Update 02.08.2022

You can also download my script from the PowerShell Gallery:

If you are interested in more Intune reporting options, you might also like my post about using Microsoft Fabric to export Intune data into the OneLake for PowerBi reporting.

If you work more with Microsoft Graph API calls, you might also like my post about the Graph Batch Endpoint.

If you want to take the next step and run scripts like this automatically, check out my post about how to start with Azure Automation Runbook to automate tasks in Intune.

Install-Script -Name Get-IntuneStatus