Find stale Entra devices
Finds Entra devices with an approximate last sign-in older than a chosen number of days
What this PowerShell script does
Finds Entra devices with an approximate last sign-in older than a chosen number of days
Requirements
- Inactive days — e.g. 90
- CSV output path — Example: C:\Temp\report.csv
- SearchBase / output override — Optional
Environment
- Module: Microsoft.Graph.Identity.DirectoryManagement
- Permissions: Device.Read.All
- Output: CSV report
- Context: Microsoft Graph PowerShell
- Risk: Low
Why use this template?
This free PowerShell script is intended for Microsoft administrators who need a repeatable way to finds entra devices with an approximate last sign-in older than a chosen number of days. It is generated locally and can be reviewed before you run it in 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
This template is generated locally in your browser. Review the generated command and test it outside production before use. Read-only describes the intended action of the template; your own wrapper scripts or surrounding commands can still change data.
Generate the script
Use the Builder to supply the required values, select the recommended PowerShell target and generate a copyable script. Nothing needs to be uploaded to Opselith.
Generate Find stale Entra devices →