Set Active Directory Tombstone

Ändern der Tombstone Lifetime

Mit diesem Skript ändern wir die tatsächliche Löschung von Objekten aus der Active Directory Datenbank NTDS.DIT. Ein im AD gelöschtes Objekt wird nicht sofort entfernt, sondern es erhält für die eingestellte Dauer das Flag is-Deleted = true und kann auch nur in dieser Zeit wiederhergestellt werden.

Default sind 180 Tage. Diesen Wert ändern wir auf 365 Tage.

Set Active Directory Tombstone

#Tombstone ermitteln
$ADForestconfigurationNamingContext = (Get-ADRootDSE).configurationNamingContext
$DirectoryServicesConfigPartition = Get-ADObject -Identity “CN=Directory Service,CN=Windows NT,CN=Services,$ADForestconfigurationNamingContext” -Partition $ADForestconfigurationNamingContext -Properties *
$TombstoneLifetime = $DirectoryServicesConfigPartition.tombstoneLifetime
Write-Output “Die Active Directory’s Tombstone Lifetime ist gesetzt auf $TombstoneLifetime Tage `r”

#Tombstone setzen
$ADForestconfigurationNamingContext = (Get-ADRootDSE).configurationNamingContext
Set-ADObject -Identity “CN=Directory Service,CN=Windows NT,CN=Services,$ADForestconfigurationNamingContext” -Partition $ADForestconfigurationNamingContext -Replace @{tombstonelifetime=”365″}

AD-Objekt löschen und wiederherstellen – Tombstoned isDeleted