Skip to content

Instantly share code, notes, and snippets.

@rdejong1979
rdejong1979 / delete-device-objects-microsoft-intune
Last active February 16, 2021 15:05
Delete obsolete/stale device objects from Microsoft Intune/Azure AD
<#
.SYNOPSIS
Delete obsolete/stale device objects from Microsoft Intune/Azure AD
.DESCRIPTION
Based on input parameters ('management agent', 'compliance state' and 'management state', 'Days last synced') the script is used to perform "housekeeping" to keep your Microsoft Intune/Azure AD clean and tidy of obsolete/stale device objects.
The script deletes device objects based on their device state, device compliance state, management channel and the number of days devices hasn't synced/connected to Microsoft Intune.
.AUTHORS
Name: Ronny de Jong