Skip to content

Instantly share code, notes, and snippets.

@irwins
Created June 13, 2017 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irwins/1a9847cb4e7b7878aa6bb6998666e07e to your computer and use it in GitHub Desktop.
Save irwins/1a9847cb4e7b7878aa6bb6998666e07e to your computer and use it in GitHub Desktop.
Get-ADObject -LDAPFilter "(sIDHistory=*)" -Property objectClass, distinguishedname, samAccountName, objectSID, sIDHistory |
Select-Object objectClass, DistinguishedName, SamAccountName, objectSID -ExpandProperty SIDHistory |
ForEach-Object {
[PSCustomObject]@{
ObjectClass = $_.objectClass
DistinguishedName = $_.DistinguishedName
SamAccountName = $_.SamAccountName
SID = $_.ObjectSID
DomainSID = $_.AccountDomainSID
SIDHistory = $_.Value
}
} |
Out-GridView -Title "AD Objects with SIDHistory"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment