Remove-ADUser permanently deletes - skips recycle bin

Dane Briggs 211 Reputation points
2023-03-16T17:47:30.69+00:00

We are going through a project to cleanup AD. We have AD Recycle Bin enabled. We are using a script to delete the users. We had a user that needed to be recovered. When I went to the Recycle Bin I noticed that none of the users that we deleted are in the Deleted Object container. Upon further testing I see deleted users in the Deleted Objects container if they were deleted using ADUC but not if deleted using powershell. Any ideas why Remove-ADUser is skipping the Recycle Bin and how to stop it from skipping?

Remove-ADUser -Server DC1 $id -Confirm:$false -Verbose -ErrorAction Stop

Upon further investigation, the Systems Admin that is running the script is using an account from a trusted domain.

We have a management domain that manages multiple domains with one way trusts.

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,960 questions
0 comments No comments
{count} votes

Accepted answer
  1. Thameur-BOURBITA 32,596 Reputation points
    2023-03-16T23:11:22.3466667+00:00

    Hi @Dane Briggs

    You can use the following command to check if the user is deleted and moved to recycle bin:

    Get-ADObject -filter 'isdeleted -eq $true -and samaccountName name -ne "SamaccountName"' -includeDeletedObjects -property *

    For you information , when the account is deleted and moved to recycle bin temporary and if the account is not restored , it will be deleted definitely.

    ![thumbnail image 1 of blog post titled

    						The AD Recycle Bin: Understanding, Implementing, Best Practices, and Troubleshooting
    						
    					
    				
    		
    	
    
    		
    

    ](/api/attachments/9c12c7aa-612a-4128-8179-6111226814d7?platform=QnA)

    Please don't forget to mark helpful answer as accepted


0 additional answers

Sort by: Most helpful