Active Directory墓碑生命周期深度解析

本文详细讲解Active Directory中墓碑生命周期的概念、默认设置变更历史及其对备份和域控制器复制的影响,并提供了使用PowerShell查询该值的实用代码示例。

Active Directory安全提示 #7:墓碑生命周期

Active Directory中的墓碑生命周期(TSL)决定了已删除对象在AD中保留的时间限制。原始值为60天,自Windows 2003 SP2起的Windows版本将此值设置为180天。

需要注意的是,此设置还会影响备份的有效期和复制机制——如果域控制器在TSL期限内未与伙伴控制器进行复制,其他域控制器将忽略该控制器。参考链接

如果您的环境仍设置为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 天。"
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计