/ 中存储网

使用PowerShell查询成员为空的通讯组

2014-08-28 22:04:22 来源:中存储网

查询输出组织内所有组成员为空的通讯组,可用于清理组成员为空的通讯组:

$DistrGroups = Get-DistributionGroup -ResultSize Unlimited
ForEach ($DistrGroup in $DistrGroups) {
if (!$(Get-DistributionGroupMember -Identity $DistrGroup.’DistinguishedName’)) {
Write-Host $DistrGroup.DisplayName “,” $DistrGroup.PrimarySmtpAddress “,” $DistrGroup.ManagedBy
}
}