Script to Remove Stale Intune Devices

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.mic

3.8 Star
947 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Problem with execution script...
    2 Posts | Last post June 22, 2018
    • I'm trying to execute script from powershell, and with appropriate credentials on Intune, but I stuck on: PS C:\Temp> & '.\Remove-StaleIntuneDevices2.ps1'
      Checking for AzureAD module...
      Authorization Access Token is null, please re-run authentication...
    • Try: Get-AuthToken
  • Error message
    2 Posts | Last post May 16, 2018
    • I'm trying to use this script with AzureADPreview module installed. I'm getting these messages:
      Checking for AzureAD module...
      AzureAD PowerShell module not found, looking for AzureADPreview
      Input string was not in a correct format.
      Not sure what input string is incorrect.
    • Disregard. I missed a step in the blog.