Wednesday, 9 January 2019

PowerShell command for permanently deleting the AD objects

Or, Removing deleted AD objects from AD database
Or, Deleting AD objects from AD database permanently which are already marked as ‘isDeleted’

Descriptions: This approach is useful when you really want to permanently delete the AD object and you no more need these entries to available in ‘DeletedObject’ container of AD.

The most important point to note here is, you would not be able to recover any AD object from Active Directory Recycle Bin once you permanently delete the objects using this PowerShell command.

Steps:
Open Windows PowerShell (run as administrator) > run the below command
-----------------------------------------------------------------------------------------------------------------------
Get-ADObject -Filter 'isDeleted -eq $true -and Name -like "*DEL:*"' -IncludeDeletedObjects | Remove-ADObject -Confirm:$false
-----------------------------------------------------------------------------------------------------------------------

Reference screenshot:





Cheers, please write me back if you have any query or feedback.

No comments:

Post a comment