Active Directory 墓碑生命周期
Active Directory 中的墓碑生命周期(TSL)决定了已删除对象在 AD 中保留的最长时间。原始默认值为 60 天,自 Windows 2003 SP2 起,Windows 版本将此值设置为 180 天。需要注意的是,此设置还会影响备份的有效期和复制行为——如果域控制器在 TSL 期限内未与伙伴进行复制,其他域控制器将忽略该控制器。详情可参考:https://adsecurity.org/?p=81
若您的环境中仍设置为 60 天,建议将其更新为 180 天。虽然这可能会因已删除对象留存时间延长而略微增加 AD 的存储负担,但在需要恢复超过 60 天的数据时,它能提供一定的故障保护机制。
使用 PowerShell 查询墓碑生命周期
以下是通过 AD PowerShell 模块查询墓碑生命周期的代码示例:
1
2
3
4
5
6
7
8
9
10
|
$ADRootDSE = Get-ADRootDSE
$ADConfigurationNamingContext = $ADRootDSE.configurationNamingContext
$TombstoneObjectInfo = Get-ADObject -Identity "CN=Directory Service,CN=Windows NT,CN=Services,$ADConfigurationNamingContext" -Partition "$ADConfigurationNamingContext" -Properties *
[int]$TombstoneLifetime = $TombstoneObjectInfo.tombstoneLifetime
IF ($TombstoneLifetime -eq 0)
{ $TombstoneLifetime = 60 }
Write-Host "AD 林的墓碑生命周期设置为 $TombstoneLifetime 天。"
|