How to retrieve the properties of a recently deleted item using Get-MgDirectoryDeleted Item

Retrieving the properties of a recently deleted item

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.

  • ADManager Plus
  • PowerShell
 

Steps to retrieve the properties of a recently deleted item using ADManager Plus

  1. Log in to ADManager Plus.
  2. Navigate to Microsoft 365 > Reports > User Reports > Recently Deleted Users.
  3. Check the box next to the desired domain to select it.
  4. Specify the time range for viewing deleted users in the Select the desired time period field.
  5. Click Generate.
  6. After the report is generated, select the filter icon to apply your desired filters and click Apply Filter(s).
Retrieve the properties of deleted items using ADManager Plus
 
 

Export reports in multiple formats, including HTML, CSV, and PDF.

 
 

Schedule automatic report generation.

Retrieve the properties of deleted objects using Microsoft Graph PowerShell

Prerequisites

Before using the Get-MgDirectoryDeletedItems cmdlet, ensure the following:

  • The Microsoft Graph PowerShell module is installed. If not, install it using this script:
    Install-Module Microsoft.Graph -Scope CurrentUser

Using the Get-MgDirectoryDeletedItem command to retrieve the properties of deleted objects

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>]

Example use cases and scripts using the Get-MgDirectoryDeletedItem cmdlet

Retrieving a list of recently deleted items

Get-MgDirectoryDeletedItem -DirectoryObjectId 'd4142c52-179b-4d31-b5b9-08940873507b'

Supported parameters

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.

Limitations of using Graph PowerShell scripts to retrieve the properties of deleted objects

  • Graph PowerShell requires IT admins to upgrade from Azure AD PowerShell and have familiarity with PowerShell scripting.
  • The Microsoft Graph API imposes throttling limits, which may affect performance when retrieving information in bulk.
  • Some attributes of deleted objects may not be retrievable or require additional API calls to fetch related data.
  • Identifying and troubleshooting errors can be time-consuming and require technical expertise.
  • The lack of an intuitive interface makes the overall experience less user-friendly, particularly for those new to scripting.

Highlights of using ADManager Plus to retrieve the properties of deleted objects

  • Provides an easy-to-use interface for managing and reporting on users, eliminating the need for complex PowerShell scripting or Graph API knowledge.
  • Simplify bulk operations through automation capabilities, optimizing for large-scale environments, and eliminating the need for complex scripts.
  • Use prebuilt or custom templates to standardize management and reporting tasks.
  • Generate customizable reports to gain detailed insights on deleted objects and export them in various formats, like CSV or HTML.
  • Delegate specific management and reporting tasks to technicians without granting them excessive permissions.

No more PowerShell hassles! Manage Microsoft Entra ID effortlessly with ADManager Plus.

 
  • Retrieving the properties of a recently deleted item
  • Retrieving the properties of a recently deleted item using ADManager Plus
  • Retrieving the properties of a recently deleted item using Microsoft Graph PowerShell
  • Limitations of using Graph PowerShell scripts to retrieve the properties of a recently deleted item
  • Highlights of using ADManager Plus to retrieve the properties of a recently deleted item
The one-stop solution to Active Directory Management and Reporting
Email Download Link