playground:microsoft_365:exchange_online:office_365_tenant_to_tenant_migrations
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
playground:microsoft_365:exchange_online:office_365_tenant_to_tenant_migrations [2021/10/29 22:50] – created admintomi | playground:microsoft_365:exchange_online:office_365_tenant_to_tenant_migrations [2021/10/29 23:16] (current) – [Distribution Group Migrations] admintomi | ||
---|---|---|---|
Line 7: | Line 7: | ||
Exporting classic distribution groups to .csv files | Exporting classic distribution groups to .csv files | ||
- | < | + | < |
- | Get-DistributionGroup -ResultSize Unlimited | Select-Object DisplayName, | + | Connect-ExchangeOnline |
+ | Get-DistributionGroup -ResultSize Unlimited | Select-Object DisplayName, | ||
</ | </ | ||
- | Exporting | + | And importing |
< | < | ||
- | **Connect-ExchangeOnline** <font 11.0pt/ | + | Import-Csv C: |
+ | $proxyaddresses | ||
+ | $managers | ||
+ | New-DistributionGroup | ||
+ | Set-DistributionGroup | ||
+ | } | ||
</ | </ | ||
+ | |||
+ | Exporting distribution lists members. I borrowed this from Internet. Problem is that this script does not output nice .csv file, needs to be redesigned. | ||
+ | < | ||
+ | |||
+ | Connect-ExchangeOnline | ||
+ | $objDistributionGroups = Get-DistributionGroup -ResultSize Unlimited | ||
+ | Foreach ($objDistributionGroup in $objDistributionGroups) | ||
+ | { | ||
+ | write-host " | ||
+ | #Get members of this group | ||
+ | $objDGMembers = Get-DistributionGroupMember -Identity $($objDistributionGroup.PrimarySmtpAddress) | ||
+ | write-host "Found $($objDGMembers.Count) members..." | ||
+ | #Iterate through each member | ||
+ | Foreach ($objMember in $objDGMembers) | ||
+ | { | ||
+ | Out-File -FilePath C: | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | Lets say you add headers to file produced on previous script for example " | ||
+ | |||
+ | You can import members to new tenant with following command | ||
+ | |||
+ | < | ||
+ | Import-Csv C: | ||
+ | Add-DistributionGroupMember -Identity $_.DisplayName -Member $_.UserPrimarySMTP | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | 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.1635537050.txt.gz · Last modified: 2021/10/29 22:50 by admintomi