Distribution Group Migration Script

Frequent Contributor

Hey Guys, 


We're in the process of migrating our distribution groups to Office 365. We already have them sync'd to the cloud but have decided (for a number of reasons) to simply migrate them to the cloud completely. (mastered on office 365) 


We're breaking this into 2 parts:


  1. Migrate Non-Nested Groups,
  2. Migrate Nested Groups. My question really applies to both. 


I found this script here: https://gallery.technet.microsoft.com/office/PowerShell-Script-to-Move-5c3cd668 its an old script but definitely works. 


The script works this way: 


  1. Copies all settings of a group you specify to a temp group (creates a temp group)
  2. you then remove the group from AD Connect run the sync process
  3. You then finalize the group, which means it basically takes the "temp" group and renames it to the original name of the group. 

The only question I have is this, when the script renames the temp group to the perm group, it prepends the SamAccountName with Cloud- for every group it migrates. 


Do you think that will be an issue? It does not affect anything that I can find, I realize if this were an all onprem environment, then it could very well be an issue. But since this is the cloud, i am not 100%. 




5 Replies

Simply edit that part of the script if it bothers you that much? Nothing in O365 cares that much about samAccountName anyway.

@Vasil Michev 


As always, thanks for the response. 


I am not concerned in terms of how it looks, that I don't care about. I just wanted to make sure that it would cause problems with the objects themselves. This is for about 7K groups. 


It doesn't sound like its going to anyways. 





@Robert Bollinger  do you have an updated link for the scripts? That link no longer shows the scripts.




You can pull it from archive.org's Wayback Machine.



Hi, I tried to seach but unable to find it.  Can you please put a link here.

many thanks.