Why use this template?
Use this free PowerShell script when you need to export entra devices. It is generated locally and can be reviewed before you run it yourself in your own PowerShell session.
The template uses Microsoft.Graph.Identity.DirectoryManagement and requires Device.Read.All. Output: CSV report. Level: Intermediate. Action: Read-only. Risk: Low.
Review before running
The script is generated in your browser. Read it before you run it, and test it outside production first. “Read-only” describes the script itself; anything you add around it can still change data.
Generate the script
- Open the template in the PowerShell Builder.
- Enter the requested values and review the module, permissions, output and risk.
- Generate the script, read it carefully, and test it outside production before use.
The script is generated locally in your browser. Nothing needs to be uploaded to Opselith.
Generate Export Entra devices →How to use this result
Use this report to inventory Entra device objects and their core operating-system, trust, management and activity properties.
When this helps
- Create an Entra device inventory before cleanup, migration or Conditional Access review.
- Compare trust type, managed/compliant flags and approximate activity across registered devices.
How to read the result
- TrustType describes the Entra device trust/join relationship; IsManaged and IsCompliant are directory-exposed properties and need workload context.
- ApproximateLastSignInDateTime is an approximate activity signal rather than an exact last-use timestamp.
Things to check
- Entra device inventory is not the same as an Intune managed-device inventory.
- A device can require separate review in Intune, Autopilot or another management system before lifecycle action.
What to do next: Use stale-device and Intune reports to investigate devices that look inactive, unmanaged or unexpectedly noncompliant.
Related tasks
Official references