Why use this template?
Use this Pro PowerShell script when you need to find entra devices with an approximate last sign-in older than a chosen number of days. It can be previewed in the Builder; Pro access is required to generate it for your own environment.
The template uses Microsoft.Graph.Identity.DirectoryManagement and requires Device.Read.All. Output: CSV report. Level: Advanced. Action: Read-only. Risk: Low.
Review before running
The script remains preview-only until Pro access is enabled. Review it before running it, and test it outside production first. “Read-only” describes the script itself; anything you add around it can still change data.
Preview the script
- Open the template in the PowerShell Builder.
- Review the purpose, requirements, permissions, output and risk.
- Activate Pro when you are ready to generate the full script, then test it outside production.
Pro templates remain previewable before purchase or activation. No tenant connection is required. When you generate a Pro script, only the configuration values needed for that template are sent to Opselith after license validation.Preview Find stale Entra devices →
How to use this result
Use this report to identify devices with an ApproximateLastSignInDateTime older than the number of days you choose.
When this helps
- Prepare a stale-device review before cleanup or device-lifecycle work.
- Compare older Entra device records by OS, trust type, management and compliance metadata.
How to read the result
- ApproximateLastSignInDateTime is an approximate Entra activity signal, not an exact last-use timestamp.
- Devices with a blank activity timestamp are intentionally excluded from the stale-date comparison and need separate review.
Things to check
- Microsoft notes that some active devices can have a blank timestamp.
- Entra device activity is not the same as Intune last check-in, Intune compliance or proof that the physical device is unused.
What to do next: Validate candidate devices against ownership, Intune/management data and recovery requirements before disabling or deleting anything.
Related tasks
Official references