Powershell从dynamic通讯组列表中排除组成员

我正试图从dynamic通讯组列表中删除特定的用户。 我已经search并玩了我的PowerShell脚本一段时间没有运气。 我确定这是我忽略的一点,因为我对OPATH语法不太了解。 我已经在EAC(2013)中创build了这个组,以包括所有电子邮件用户的内部和云。

当我做一个:

Get-DynamicDistributionGroup –Identity “Email Users” | fl 

它作为RecipientFilter返回:

 {((((RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUser'))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))} 

我想排除组DDGExclude的所有成员。 我已经尝试将下面的命令添加到命令中,但没有运气。

 -and (-not(MemberOfGroup -eq 'DDGExclude')) 

我还想了解如何排除ExtensionCustomAttribute10NOSYNC 。 我尝试了以下,没有运气。

 -and (ExtensionCustomAttribute10 -ne “NOSYNC”) 

任何帮助将非常感激。

有一件事是不要在PowerShell命令中使用无效字符。

 -and (-not(MemberOfGroup -eq 'DDGExclude')) 

应该:

 -and (-not(MemberOfGroup -eq 'DDGExclude')) 

也:

 -and (ExtensionCustomAttribute10 -ne “NOSYNC”) 

应该:

 -and (ExtensionCustomAttribute10 -ne "NOSYNC")