1
2
3
4
5
6
7
8
9
|
#定义所有邮箱变量
$mailbox
=
Get-Mailbox
-ResultSize
unlimited |%{
$_
.
Alias
}
#查询一个月之内账户是否有收发邮件的日志如果没则显示这个账户
foreach
(
$user
in
$mailbox
){
$send
=
Get-MessageTrackingLog
-Sender
$user
@contoso
.com
-Start
"03/08/2014"
-ResultSize
unlimited
|Measure
-Object|%{
$_
.count}
$receive
=
Get-MessageTrackingLog
-Recipients
"$user@contoso.com"
-Start
"03/08/2014"
-ResultSize
unlimited
|Measure
-Object|%{
$_
.count}
if
(
$send
-eq
"
" -and $receive -eq ""
){
write-host
$user
}
}
PS:基本逻辑:通过
foreach
循环分别查询账户收发邮件的日志数量,再用
if
语句做一个判断然后将匹配的账户显示出来
|
本文转自handsome7038 51CTO博客,原文链接:http://blog.51cto.com/lixiaosong/1392069