User Tools

Site Tools


playground:microsoft_365:exchange_online:office_365_tenant_to_tenant_migrations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
playground:microsoft_365:exchange_online:office_365_tenant_to_tenant_migrations [2021/10/29 22:53] – [Distribution Group Migrations] admintomiplayground:microsoft_365:exchange_online:office_365_tenant_to_tenant_migrations [2021/10/29 23:16] (current) – [Distribution Group Migrations] admintomi
Line 13: Line 13:
 </code> </code>
  
-Exporting distribution lists members+And importing distribution lists. If importing another tenant, remember to clean onmicrosoft.com aliases and rename domains if needed. 
 +<code> 
 + 
 +Import-Csv C:\temp\distribution_list_export.csv | foreach { 
 +$proxyaddresses = $_.EmailAddresses -split ' ' 
 +$managers = $_.ManagedBy -split ' ' 
 +New-DistributionGroup -Name $_.DisplayName -ManagedBy $managers -PrimarySmtpAddress $_.PrimarySmtpAddress -RequireSenderAuthenticationEnabled $_.RequireSenderAuthenticationEnabled -WhatIf 
 +Set-DistributionGroup -Identity $_.DisplayName -EmailAddresses @{add= $proxyaddresses} -WhatIf 
 +
 + 
 +</code> 
 + 
 +Exporting distribution lists members. I borrowed this from Internet. Problem is that this script does not output nice .csv file, needs to be redesigned.
 <code> <code>
  
Line 32: Line 44:
  
 </code> </code>
 +
 +Lets say you add headers to file produced on previous script for example "DisplayName,PrimarySMTPAddress,User,UserPrimarySMTP,Mailboxtype" (Add first line on file)
 +
 +You can import members to new tenant with following command
 +
 +<code>
 +Import-Csv C:\temp\distributiongroup_importmembers.csv | foreach {
 +Add-DistributionGroupMember -Identity $_.DisplayName -Member $_.UserPrimarySMTP
 +}
 +
 +</code>
 +
 +Yet again pay attention to UPN if it needs to be changed before importing.
  
  
playground/microsoft_365/exchange_online/office_365_tenant_to_tenant_migrations.1635537181.txt.gz · Last modified: 2021/10/29 22:53 by admintomi