【发布时间】:2017-08-30 01:05:36
【问题描述】:
我无意中通过 Exchange 管理中心将共享邮箱添加到了通讯组中,但由于 EAC 未指定邮箱类型(我可能会意外删除常规邮箱),因此无法删除它们
我尝试编写一个 Powershell 脚本来完成任务,但它不起作用。
$DistributionGroups = Get-Distributiongroup
$SharedMailboxes = Get-mailbox -RecipientTypeDetails sharedmailbox
ForEach ($Group in $DistributionGroups)
{
ForeEach ($Mailbox in $SharedMailboxes)
{
if ((Get-Distributiongroupmember $Group.Name | select -expand name) -contains $Mailbox)
{
Remove-DistributionGroupMember -Identity "$Group" -Member "$Mailbox"
}
}
}
【问题讨论】:
-
抱歉,我没有看到编辑按钮(我以为它像 Reddit)。已更新。
-
没问题,无论是问题还是答案,它都存在于您发布的每个帖子中,请尝试在需要澄清任何内容时使用它,而不是在 cmets 中添加信息
标签: powershell office365 exchange-server