查询3天内创建邮箱的用户
$d = (Get-Date).adddays(-3)
$ys = Get-ADUser -Filter 'Enabled -eq $true -and msExchWhenMailboxCreated -ne "$null" -and msExchWhenMailboxCreated -ge $d' -Properties msExchWhenMailboxCreated
$ys.Count#此方式问题:如果用户创建邮箱后删除邮箱,然后再重新创建邮箱,msExchWhenMailboxCreated记录的时候还是第一次创建的时候使用如下方式准确性较高:
$d = (Get-Date).adddays(-3)
$ys = Get-ADUser -Filter ‘Enabled -eq $true -and mail -ne “$null” -and WhenChanged -ge $d’ -Properties WhenChanged,mail,msExchWhenMailboxCreated
$ys|select samaccountname,mail,whenchanged,msExchWhenMailboxCreated
$ys.Count
Original: https://www.cnblogs.com/dreamer-fish/p/16419213.html
Author: momingliu11
Title: 查询3天内创建邮箱的用户
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/551647/
转载文章受原作者版权保护。转载请注明原作者出处!