Removing SID-History

Single User

Get-ADUser USERNAME -properties sidhistory | foreach {Set-ADUser $_ -remove @{sidhistory=$_.sidhistory.value}}

Single group

Get-ADGroup GROUPNAME -properties sidhistory | foreach {Set-ADGroup$_ -remove @{sidhistory=$_.sidhistory.value}}

All Users within a OU with an SID History

Get-ADUser -SearchBase “OU=Accounts,DC=mydomain,DC=com” -Filter {sidhistory -like “*”} -properties sidhistory | foreach {Set-ADUser $_ -remove @{sidhistory=$_.sidhistory.value}}

All Groups within a OU with an SID History

Get-ADGroup -SearchBase “OU=Accounts,DC=mydomain,DC=com” -Filter {sidhistory -like “*”} -properties sidhistory | foreach {Set-ADGroup $_ -remove @{sidhistory=$_.sidhistory.value}}

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments