取出每个数据库最近30分钟登录的用户数量

 

#取出每个数据库最近30分钟登录的用户数量
Add-PSSnapin microsoft.exch*
$dbs = Get-MailboxDatabase |sort server

foreach ($db in $dbs)
{
$uinfor = Get-MailboxStatistics -database $db| ? {$_.LastLogonTime -ne $null } | ? {$_.lastlogontime.addminutes(30) -gt (get-date)}
$db.name + "," + $db.Server + "," + $uinfor.count |Out-File D:\Operations\Scripts\ms2.csv -Encoding utf8 -Append
}

 

posted on 2018-03-12 18:12  momingliu11  阅读(305)  评论(0编辑  收藏  举报