PowerShell quickly creates dynamic distribution groups under Exchange2010

Source: Internet
Author: User

There is a small demand in exchange, many departments to apply for dynamic communication groups, the problem is level two department three department level four Department is very very much. ......

Get-adobject-ldapfilter "(& (& (ou>=)))"-searchbase ' ou=xx,ou=xxx,dc=xxx,dc=xxx,dc=com '-properties CanonicalName | FT Canonicalname-a | Out-file d:\oudaoteng.csv-Encoding UTF8

The above statement requires the PowerShell management tool with Active Directory to execute and output text similar to the following

CONTOSO.COM/XXXX company/xxxxsales/Industry Marketing Department CONTOSO.COM/XXXX company/xxxxsales/Business Operation Contoso.com/xxxx Company/xxxxsales/Business Co Ntoso.com/xxxx company/xxxxsales/East China brand Marketing Center CONTOSO.COM/XXXX company/xxxxsales/Business Operations CONTOSO.COM/XXXX Company/xxxxsales/Business Operation Service CONTOSO.C Om/xxxx company/xxxxsales/North China brand Marketing Center CONTOSO.COM/XXXX company/xxxxsales/Business Operation Service Group CONTOSO.COM/XXXX company/xxxxsales/Business Operation Contoso.com/xx XX company/xxxxsales/Business Operation Contoso.com/xxxx Company/xxxxsales/South China brand Marketing Center

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/91/wKioL1VMaOOz85NOAAWnbyYR-J8303.jpg "style=" float: none; "title=" QQ picture 20150508152412.png "alt=" Wkiol1vmaooz85noaawnbyyr-j8303.jpg "/>


Well, the above output is actually false, but it is guaranteed that these OUs will not have duplicate names, and even the sub-OUs contain

And then there's a hard-pressed operation.

Open this CSV file, copy a new sheet, copy the file past, remove the domain name and/or part, so that the Chinese part is left, I am going to use the Chinese part to do this dynamic distribution group Chinese name, and then pull a column, random word to do English name. "This piece can be used in Excel, the first letter of Chinese name."

The first line to give them a name, CN CB CA, of course, this is casually written.

Well, after we get this file, I'm going to make it into the UTF8 format, "It's still going to take a little bit of effort."

Finally, run the following command in EMC for Exchange.

Import-csv-path E:\oudaoteng.csv | foreach {new-dynamicdistributiongroup-name $_.cb-recipientcontainer $_.cn-includedrecipients ' AllRecipients '-Alias $_.ca}

Or, using the following sentence, he will output the output "result" to a text file. Note that the result is that there is no need to select *, the output will be less, or you can choose the desired output item

Import-csv-path D:\oudaoteng.csv | foreach {new-dynamicdistributiongroup-name $_.cb-recipientcontainer ' contoso.com '-includedrecipients ' Allrecipients '-alias $_.ca |select *|out-file C:\file.txt-append}


Then the second is open, cool!


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6C/96/wKiom1VMZ27hlw1WAAKMvR16YnQ409.jpg "title=" QQ picture 20150508152959.png "style=" Float:none; "alt=" wkiom1vmz27hlw1waakmvr16ynq409.jpg "/>

This article is from the "Nine uncle-Microsoft Private Cloud" blog, please make sure to keep this source http://jiushu.blog.51cto.com/972756/1649614

PowerShell quickly creates dynamic distribution groups under Exchange2010

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.