Categories

Deleted user accounts–correction

In the last post which looked at finding user accounts that had been deleted I had this syntax for the Microsoft cmdlets

Get-ADObject -Filter {isDeleted -eq $true -and name -ne "Deleted Objects" } -IncludeDeletedObjects |
Format-List Name, Distinguishedname
 

This had a mistake that I missed. It will return all deleted objects.  The syntax should be

Get-ADObject -Filter {objectclass -eq "user" -and isDeleted -eq $true -and name -ne "Deleted Objects" } -IncludeDeletedObjects |
Format-List Name, Distinguishedname
 

Adding

objectclass -eq "user"

to the filter ensures that we only get deleted user objects

Leave a Reply