PowerShell script that uses Graph API to connect to Intune and retire/delete stale devices that have not checked in to the service within the past 90 days. Corresponding blog post on how to automate the retire and deletion of devices can be found here: https://blogs.technet.microsoft.com/smeems/2018/03/07/device-cleanup-with-graph-api/

 

 

***Script updated 4/27/2018 to add a delay between wipe and delete operations. This will prevent issues when deleting large nymbers of records***