1. 程式人生 > >Powershell分享1--動態組,靜態組

Powershell分享1--動態組,靜態組

powershell

一、創建
1.靜態組
        New-DistributionGroup  -Name "PingTai"   -Type Distribution
2.動態組
        New-DynamicDistributionGroup   -Name "group" -RecipientContainer "corp.homelink.com.cn/鏈家網/CFO線/"  -ConditionalCustomAttribute1  "經紀人"  -IncludedRecipients MailboxUsers
3.批量創建動態組
        import-csv C:\Users\fanyunxiao\批量新建動態郵件組.csv  | foreach {New-DynamicDistributionGroup -Name  $_.name  -RecipientContainer  $_.recipientContainer   -ConditionalCustomAttribute1   $_.ConditionalCustomAttribute1  -IncludedRecipients  mailboxusers}

二、添加人員

1.靜態組
        import-csv C:\Users\fanyunxiao\批量添加靜態組成員.csv | foreach {Add-DistributionGroupMember "group0101" -Member $_.mail}

三、查詢動態組人員

            Get-Recipient -RecipientPreviewFilter (Get-DynamicDistributionGroup -Identity **[email protected]**).LdapRecipientFilter -OrganizationalUnit (Get-DynamicDistributionGroup -Identity **[email protected]**).RecipientContainer -ResultSize unlimited

Powershell分享1--動態組,靜態組