Hi,
I’m tried to delete some specific SIDHistory after a lot of migrations. I have a problem with my script because if some objects has more than 1 SIDHistory, it clear all of them and I don’t want that.
$SID_Recherche = S-1-5-21-2952651426-2628096683-2210756013 $CheminArborescence = "OU=TOTO, OU=TOTO, OU=_TOTO, DC=TEST, DC=local" Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser -Force #Import du module AD Import-Module ActiveDirectory Import-Module SIDHistory Get-SIDHistory -SearchBase $CheminArborescence –DomainSID $SID_Recherche | export-csv C:\Users\A003634\Desktop\ScopedSIDHistory.csv Get-SIDHistory -SearchBase $CheminArborescence –DomainSID $SID_Recherche | Remove-SIDHistory | Export-CSV C:\Users\A003634\Desktop\RemovedSIDhistory.csv
For example, I want to choose object with this SIDHistory S-1-5-21-2952651426-2628096683-2210756013 but if the object got many SIDHistory, it delete all of them.
How can I do it better ?
Thank you