🎉 Our Microsoft 365 Reporting & Management Tool is now available in Azure Marketplace 🚀
This website uses cookies to improve your experience. We'll assume you're ok with this. Know more.
Active Directory

How to Detect Deleted Users in Active Directory

Deleted users in Active Directory can disrupt workflows, compromise security, and leave critical responsibilities unassigned. Whether due to accidental deletions or malicious activity, swiftly identifying and addressing these deletions is key to maintaining operational stability while protecting critical resources. Stay proactive and learn how to identify deleted Active Directory users before it impacts your organization’s performance.

Get Deleted AD Users Using Active Directory Administrative Center

Active Directory Permission Required
Domain Admins Least Privilege
Administrators Most Privilege
  • Open Server Manager and navigate to the Tools»Active Directory Administrative Center.
  • Ensure the Recycle Bin is enabled; if not, right-click your domain name and select Enable Recycle Bin.
  • Click on Deleted Objects under your domain name.
  • Here, you can view deleted Active Directory users along with other deleted objects. The deleted users are listed as User in the Type column.
Get Deleted AD Users Using Active Directory Administrative Center

Note: Deleted objects will remain available here for the duration of the tombstone period (typically 180 days), after which they are permanently removed from the Active Directory.

Find Active Directory Deleted Users Using Windows PowerShell

Active Directory Permission Required
Domain Admins Least Privilege
Administrators Most Privilege
  • Open the Windows PowerShell with an administrative account.
  • Ensure the Active Directory module is imported.
  • Run the below cmdlet to get the deleted users in the Active Directory.
  • Windows PowerShell Windows PowerShell
     Get-ADObject -Filter 'isDeleted -eq $true -and ObjectClass -eq "user"' -IncludeDeletedObjects | ft Name, DistinguishedName
Find Active Directory Deleted Users Using Windows PowerShell

Audit All Deleted Users in Active Directory Using Event Viewer

Active Directory Permission Required
Event Log Readers Least Privilege
Administrators Most Privilege
    • While the methods above only show recently deleted users in AD, this approach records all deletion events that have occurred in the respective system.
    • Navigate to Tools»Event Viewer in Server Manager, select Windows Logs, and then "Security".
    • Click on Filter Current Log… and enter 4726 in <All Event IDs> to identify deleted users in Active Directory.
    • The Target Account field in each event shows the deleted AD user accounts.
Audit All Deleted Users in Active Directory Using Event Viewer

You can identify who deleted the user using the Subject field.

Master Deleted User Tracking in Active Directory with AdminDroid!

The Active Directory reporting tool equips administrators with essential AD user data, enabling smarter management decisions. You can strengthen security and streamline user management by accessing detailed reports on deleted users, expired accounts, inactive users, restored accounts, and more.

Stay Informed on Active Directory User Deletions

Use AdminDroid alerts to receive instant notifications about each user's deletions in AD and ensure swift restoration in case of unintentional or malicious deletions.

Delete Active Directory Users with Prolonged Inactivity

Audit user login activity and delete users with prolonged inactivity after disabling them for some days to ensure proper offboarding.

Clean Up Expired Accounts for Better User Management

Review expired user accounts in AD identify those without access and remove them if they are no longer needed.

Track Stale AD Accounts with Unchanged Passwords

Monitor AD users' password details to identify accounts that haven't changed passwords in the last six months, then disable and remove them to improve security.

Remove Inactive Admins to Prevent Unauthorized Access

Disable or delete inactive AD admins to reduce the attack surface, as their higher privileges make them prime targets for exploitation.

Recover Deleted Computers to Maintain Continuous Workflow

Prevent login issues and minimize downtime for users by restoring accidentally deleted AD computer accounts to ensure users can resume work without productivity loss.

While these reports provide valuable insights, remember that proactive management is key to minimizing risks! Leverage AdminDroid’s Active Directory management tool to stay ahead of threats and keep your AD environment secure & organized.

Explore a full range of reporting options

Important Tips

Disable the AD user for a certain period before deletion to resolve ownership disputes and review access permissions.

Regularly identify and remove inactive AD users, as they are vulnerable to security breaches by malicious actors.

Raise the forest functional level to Windows Server 2008 R2 or higher to enable the Active Directory Recycle Bin and restore users.

Common Errors and Resolution Steps

The following are the possible errors and troubleshooting hints while managing Active Directory deleted users.

Error Remove-ADUser : Access is denied

This error may occur in PowerShell while trying to delete a user who is protected from accidental deletion.

Fix Use the cmdlet below to set the ProtectedFromAccidentalDeletion property of users to false and then try deleting them.
Get-ADUser "<SAMAccountName>" | Set-ADObject -ProtectedFromAccidentalDeletion $false 

Error Restore-ADObject : Directory object not found

This error occurs in Active Directory PowerShell when the specified object does not exist in the Deleted Objects container. Otherwise, the provided distinguished name of the user is incorrect.

Fix Ensure the object's identity (distinguished name) is correct and verify its existence in the Deleted Objects container.

Error Cannot find an object with identity: 'Sofia' under 'DC=O365Droid,DC=onmicrosoft,DC=com'

This error may occur when executing the bulk user removal script in the Active Directory PowerShell.

Fix Verify if the user exists in your Active Directory environment. If present, ensure their sAMAccount name is correctly spelled in the CSV file.

Error Get-WinEvent : No events were found that match the specified selection criteria.

This error occurs in Active Directory PowerShell while running the cmdlet without sufficient permissions to access the specified event log.

Fix Run PowerShell as an administrator or use an account with adequate permissions like event log reader to access the events.

Error The operation could not be performed because the object's parent is either uninstantiated or deleted.

This error occurs in the Active Directory Administrative Center when you attempt to restore a child object using the Restore option before restoring its parent.

Fix Ensure that you restore the parent object first before attempting to restore any child objects.

1. When to delete the Active Directory users?

The debate over whether to disable or delete user accounts when employees leave the organization is constant. For accounts that are no longer needed or for inactive users disabling the account temporarily is a recommended approach. This period allows time to monitor for any issues. If no problems arise during this time, the account can be deleted to reduce unnecessary clutter and mitigate any possible security risks.

How to delete an Active Directory user?

  • Open Active Directory Users and Computers snap-in.
  • Navigate to the respective OU and right-click the user who you wish to delete.
  • Choose Delete and confirm the deletion process by clicking Yes in the prompt.
delete-users-in-active-directory

How to delete a user in Active Directory using PowerShell?

  • Open the Administrative Windows PowerShell.
  • Execute the following command to delete a specific AD user.
Remove-ADUser -Identity "<UserName>"

Replace the <UserName> with the distinguished name or sAMAccountName of the AD user you want to delete.

deletion-of-ad-user-powershell

2. How to delete multiple users in Active Directory?

Manually removing multiple users from Active Directory can be a challenging and error-prone task. It not only consumes valuable time but also increases the risk of accidental deletion. To streamline this process and eliminate the need for repetitive actions, use the following script. It offers an efficient way to delete multiple Active Directory users with ease.

To bulk delete AD users using a CSV file

  • Prepare a CSV file with the users’ sAMAccountName as shown below.
    delete-ad-users-csv-file
  • Run the following script in Windows PowerShell to perform bulk removal of AD users.

Import-Csv '<FilePath>' | Foreach-Object {
  Try {
    Get-ADUser $_.SamAccountName -ErrorAction SilentlyContinue | Out-Null
    Remove-ADUser $_.SamAccountName-Confirm:$False
  }
  Catch {
    Write-Host "Username '$_.SamAccountName' not found in Active Directory"
  }
} 

Replace the <FilePath> in the PowerShell script with the path where the CSV file is stored.

bulk-ad-user-removal

3. How to restore deleted Active Directory users?

Restoring deleted Active Directory users is crucial for recovering accidentally removed user accounts. It ensures uninterrupted user access, avoids workflow disruptions, and prevents downtime.

However, Deleted AD user accounts can only be restored within the tombstone period after deletion. Once this period expires, the object will be permanently removed and cannot be restored. The tombstone lifetime is typically set to 180 days by default but can be modified in Active Directory.

Restore users in Active Directory using ADAC

  • Open Active Directory Administrative Center.
  • In the left-hand pane, click Deleted Objects under the domain name.
  • Right-click on the user and select any of the following options to complete the restoration process.

    Restore: You can use this option to restore the user account to the same Organizational Unit (OU) where it was before deletion.

    Restore to: This option allows you to select a new Organizational Unit as the destination for restoring the user account.

restore-active-directory-user
  • Note: When the 'Deleted Objects' container is not found under the domain name, click on the domain and check the right pane for its presence. If it's still missing, enable the Recycle Bin by right-clicking the domain and selecting Enable Recycle Bin.

Restore Active Directory users using PowerShell

  • To restore the deleted users in Active Directory, run the below cmdlet.
Restore-ADObject -Identity "<UserName>"

Replace the <UserName> with the distinguished name of the user you wish to restore.

You can use the below cmdlet to get the distinguished name of the AD users.

Get-ADUser -filter * | Select-Object Name, DistinguishedName

It’s vital to check restored users, as they carry the hidden risks of retaining their previous resource permissions.

Keep a close eye on restored AD users and what they can still access with AdminDroid!

  • You can track the restored users report to identify details such as who restored the users, when it occurred, etc.

  • This enables you to quickly detect any unintended actions, such as restoring the wrong users and allowing for immediate corrective measures.

restored-user-events-droid

4. How to find who deleted the users in Active Directory?

Losing important user accounts in Active Directory can be a major setback, but finding out who deleted them is the real puzzle. It’s not just about recovering lost accounts; it’s about understanding the why and how behind every deletion to maintain security, accountability, and control.

Find out who deleted the Active Directory users using PowerShell

  • Open the Windows PowerShell with an Administrative account.
  • Run the below cmdlet to get the user who deleted the Active Directory users.
Get-EventLog -LogName Security |
Where-Object {$_.EventID -eq 4726} |
Select-Object -Property EventID, MachineName, TimeGenerated, Source, Message
active-directory-deleted-users-event-powershell

The above cmdlet retrieves the user deletion event log entry and provides a complete view of the event’s properties. In this output, you can find who deleted the user under Message»Subject

If you are looking for specific information like the time of deletion, who performed the deletion, and the deleted users, you can use the below cmdlet.

Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4726} |
Select-Object TimeCreated,
  @{Name='DeletedUser'; Expression={($_.Properties[0].Value)}},
  @{Name='DeletedBy'; Expression={($_.Properties[1].Value)}}
who-deleted-the-users-powershell

Instantly identify who deleted the user account in Active Directory using AdminDroid!

The deleted users report provides an audit trail of all user deletions in your organization. It includes details such as who deleted the user, when it occurred, audit status, event logged computer, and more.

audit-deleted-users-in-ad

Handy Tip: You can easily download the report in your preferred format, such as CSV, PDF, etc., for easy sharing and record-keeping using AdminDroid’s export feature.

5. How to protect users from deletion in the Active Directory?

In Active Directory, users managing sensitive groups and resources are essential for maintaining security and oversight. Accidental deletion of these users can open the door to unauthorized access and affect the management of critical resources. To prevent security risks and ensure proper access control, it's vital to protect these high-privileged user accounts from unintended deletion.

Protect users from accidental deletion in AD

  • Open Active Directory Users and Computers console.
  • Right-click the user you wish to protect from deletion and select Properties.
  • Go to the Object tab, and check the box labelled “Protect object from accidental deletion”.
  • Click Apply to enable protection for the Active Directory user.
protect-users-from-accidental-deletion
  • Note: Enable Advanced Features in the View option of the toolbar to access the Object tab in user properties and enable protection.

Protect a user from deletion using PowerShell

Execute the below PowerShell cmdlet to protect users from unintentional deletion in Active Directory.

Set-ADObject -Identity "<UserName>" -ProtectedFromAccidentalDeletion $true

Replace the <UserName> with the distinguished name of the user you wish to protect.

  • Note:You can also replace the <UserName> with the distinguished name of OUs, groups, etc., to protect the respective objects from accidental deletion.

Access a complete list of all protected AD users with AdminDroid’s report!

  • The users protected from accidental deletions report provides valuable insights into all users protected within your organization.

  • This report offers detailed information about each protected user, including SAM account name, account status, manager, and more.
  • It helps you identify critical users who are not yet protected, allowing you to take action and secure their accounts.
users-protected-from-accidental-deletion

Kickstart Your Journey With
AdminDroid

Your Microsoft 365 Companion with Enormous Reporting Capabilities

Download Now
User Help Manuals Compliance Docs
x
Delivering Reports on Time
Want a desired Microsoft 365 reports every Monday morning? Ensure automated report distribution and timely delivery with AdminDroid's Scheduling to your email anytime you need.
Delivering Reports on Time
Schedule tailored reports to execute automatically at the time you set and deliver straight to the emails you choose. In addition, you can customize report columns and add inteligent filtering to the activities just from the previous day to suit your Microsoft 365 report requirements.
Set It, Schedule It, See Results- Your Reports, Your Way, On Your Time!
Time Saving
Automation
Customization
Intelligent Filtering
Give Just the Right Access to the Right People
Grant fine-tuned access to any Microsoft 365 user with AdminDroid’s Granular Delegation and meet your organization’s security and compliance requirements.
Give Just the Right Access to the Right People
Create custom roles loaded with just the right permissions and give access to admins or normal users within AdminDroid. The result? A streamlined Microsoft 365 management experience that aligns your organization's security protocols and saves your invaluable time and effort.
Align, Define, Simplify: AdminDroid's Granular Delegation
Smart Organizational Control
Effortless M365 Management
Simplified Access
Advanced Alerts at a Glance
Receive quick notifications for malicious Microsoft 365 activities. Engage with the AdminDroid’s real-time alert policies crafted to streamline your security investigations.
Advanced Alerts at a Glance
Stay informed of critical activities like suspicious emails and high-risk logins, bulk file sharing, etc. Through creating and validating ideal alert policies, AdminDroid provides a comprehensive approach to real-time monitoring and management of potential threats within your organization.
AdminDroid Keeps You Always Vigilant, Never Vulnerable!
Proactive Protection
Real-time Monitoring
Security Intelligence
Threat Detection
Merge the Required Data to One Place
Combine multiple required columns into one comprehensive report and prioritize the information that matters most to you with AdminDroid’s Advanced Column Customization.
Merge the Required Data to One Place
This column merging capability offers a flexible way to add different columns from various reports and collate all the essential data in one place. Want to revisit the customized report? Save it as a 'View’, and your unique report is ready whenever you need it.
Merge with Ease and Save as Views!
Custom Reporting
Unique View
Desired Columns
Easy Data Interpretation
Insightful Charts and Exclusive Dashboards
Get a quick and easy overview of your tenant's activity, identify potential problems, and take action to protect your data with AdminDroid’s Charts and Dashboards.
Insightful Charts and Exclusive Dashboards
With AdminDroid charts and dashboards, visualize your Microsoft 365 tenant in ways you've never thought possible. It's not just about viewing; it's about understanding, controlling, and transforming your Microsoft 365 environment.
Explore Your Microsoft 365 Tenant in a Whole New Way!
Executive overviews
Interactive insights
Decision-making
Data Visualization
Efficient Report Exporting for Microsoft 365
Downloading your reports in the right file format shouldn’t be a hassle with AdminDroid’s Report Export. Experience seamless report exporting in various formats that cater to your needs.
Efficient Report Exporting for Microsoft 365
Navigate through diverse options and export Microsoft 365 reports flawlessly in your desired file format. Tailor your reports precisely as you need them and save them directly to your computer.
Take Control, Customize and Deliver- Your Office 365 Data, Exported in Your Way!
Easy Export
Seamless Downloading
Data Control
Manage Microsoft 365

Get AdminDroid Office 365 Reporter Now!