Accidental deletion of Microsoft Entra ID users can cause service disruptions, data loss, and security risks. While Graph PowerShell's Get-MgDirectoryDeletedItem command — an alternative to the Get-AzureADDeletedApplication command—can be used to retrieve the properties of a recently deleted item, its complexity and non-intuitive interface make it a challenging option. On the other hand, ADManager Plus, a Microsoft 365 management and reporting tool, simplifies the process, allowing admins to retrieve the properties of deleted items with just a few clicks.
Export reports in multiple formats, including HTML, CSV, and PDF.
Schedule automatic report generation.
Before using the Get-MgDirectoryDeletedItems cmdlet, ensure the following:
Install-Module Microsoft.Graph -Scope CurrentUser
The Get-MgDirectoryDeletedItem cmdlet can be used in Microsoft Graph PowerShell to retrieve the properties of deleted objects. Here's the syntax:
Get-MgDirectoryDeletedItem
-DirectoryObjectId <String>
[-ExpandProperty <String[]>]
[-Property <String[]>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Retrieving a list of recently deleted items
Get-MgDirectoryDeletedItem -DirectoryObjectId 'd4142c52-179b-4d31-b5b9-08940873507b'
The following table contains some parameters that can be used along with the Get-MgDirectoryDeletedItem command to retrieve the properties of deleted objects.
| Parameters | Description |
|---|---|
| -DirectoryObjectId | This parameter displays the unique identifier of the directory object. |
| -ExpandProperty | This parameter expands related entities of the object. |
| -Headers | This parameter allows you to add optional headers. |
| -UserId | This parameter displays the unique identifier of the user. |
| -WhatIf | This parameter displays the outcome if the cmdlet is executed. |