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

Published Wed, Mar 21 2012 20:54 by RichardSiddaway

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: