First, create
1.静态组 New-DistributionGroup -Name "PingTai" -Type Distribution2.动态组 New-DynamicDistributionGroup -Name "group" -RecipientContainer "corp.homelink.com.cn/链家网/CFO线/" -ConditionalCustomAttribute1 "经纪人" -IncludedRecipients MailboxUsers3.批量创建动态组 import-csv C:\Users\fanyunxiao\批量新建动态邮件组.csv | foreach {New-DynamicDistributionGroup -Name $_.name -RecipientContainer $_.recipientContainer -ConditionalCustomAttribute1 $_.ConditionalCustomAttribute1 -IncludedRecipients mailboxusers}
Second, add personnel
1.静态组 import-csv C:\Users\fanyunxiao\批量添加静态组成员.csv | foreach {Add-DistributionGroupMember "group0101" -Member $_.mail}
Third, query dynamic group personnel
Get-Recipient -RecipientPreviewFilter (Get-DynamicDistributionGroup -Identity **[email protected]**).LdapRecipientFilter -OrganizationalUnit (Get-DynamicDistributionGroup -Identity **[email protected]**).RecipientContainer -ResultSize unlimited
PowerShell share dynamic group, static group