PowerShell Script to Create Cloud Contacts for Dynamic Groups in Exchange Hybrid

This script creates contact objects in Exchange Online to represent Dynamic Distribution Groups on-premises.

 
 
 
 
 
5 Star
(5)
3,756 times
Add to favorites
Office 365
11/17/2014
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Thanks!
    1 Posts | Last post April 12, 2017
    • I would like to say thanks! 
      
      I added some to the for each loop to skip if the list already exists.
      
      # Create Contacts in Exchange Online
      foreach ($DDG in $DDGs) {
      $DDGname = $DDG.name
        if (Get-cloudmailcontact $DDGname) {write-host "Cloudmailcontact $DDGname exists, skipping"; continue}
       
      I ran it on a 2016 exchange server, is it possible to do it on another version or is it only able to run on 2013/2016 exchange due to "Set-AdServerSettings". In that case maybe a #comment in the script could be nice to point those who might use it in the right direction. 
      
      Again thanks.
      
      
      
  • Dynamic distribution group in Exchange 2010
    1 Posts | Last post July 13, 2016
    • We have Exchange 2010.  Will the script work to update the dynamic distribution groups in Office 365?
  • Dynamic distribution group in Exchange 2013
    3 Posts | Last post February 20, 2015
    • Hello, i am using exchange 2013 and i want to create dynamic distribution group with a script but i couldn't find a script that i am looking. i went thru this script but this looks to be for cloud exchange and my exchange is hosted locally can you please send me or refer me to script to create dynamic distribution group in exchange.
      
      Thanks!
    • This script is actually for a situation unique to Exchange Online.
      
      For creating dynamic distribution groups in Exchange 2013, I would recommend looking at the syntax in the "New-DynamicDistributionGroup" cmdlet: https://technet.microsoft.com/en-us/library/bb125127(v=exchg.150).aspx
    • Hello Joseph,
      
      thank you very much for the reply.
      this is what i was looking for. it helped me and made it work.
      
      thanks again!
      
      Ahmad
  • Accomodating LegacyExchangeDN
    2 Posts | Last post November 17, 2014
    • Adding -EmailAddresses @{Add=("X500:"+$DDG.LegacyExchangeDn)} to the end of the Set-CloudMailContact line will allow for replying to old messages or name caching of DDGs in Outlook.
    • Thanks for the recommendation; I've added it to the uploaded script.