$weeks = 4 # first, find out the AD time format from # 4 weeks ago that will be used in the LDAPFilter
$today = Get-Date # 4 weeks ago $cutDate = $today.AddDays(-($weeks * 7)) # translate in AD time format $cutDateAD = $cutDate.ToFileTimeUtc()
# next, find a way to convert back the AD file format $realDate = @{ Name = 'Date' Expression = { if ($_.pwdLastset -eq0) { '[never]' } else { [DateTime]::FromFileTimeUtc($_.pwdLastset) } }