SFB 项目经验-61-跨林迁移通讯组-Export the Distribution Groups

用户需求:

客户在跨林迁移Exchange 2010到2010的时候,需要迁移很多通讯组,其中通讯组又包括许多用户。

如何迁移是最简单,最方便呢?

通过以下步骤就可以实现跨林批量迁移通讯组。

解决方法:

*********************

1.用户域(导出-通讯组)

*********************

####################################################

Active Directory Module (ADM) for Windows PowerShell

####################################################

Export the Distribution Groups

Get-ADGroup -Filter {GroupCategory -eq "Distribution"}|select Name | Export-Csv -Path "c:\Export\DGList.csv"

*********************

2.目标域(导入-通讯组)

*********************

&&&&&&&&&&&&&&&&&&&&&&&&&

Exchange Management Shell

&&&&&&&&&&&&&&&&&&&&&&&&&

imported the distribution groups

Import-Csv "C:\Export\DGList.csv" | ForEach {New-DistributionGroup -Name $_.Name}

******************************

3.用户域(导出-通讯组-中-用户)

******************************

####################################################

Active Directory Module (ADM) for Windows PowerShell

####################################################

Get-ADGroup -Filter {GroupCategory -eq "Distribution"}| ForEach-Object{

$group=$_

$users=Get-ADGroupMember -Identity $group

foreach ($dguser in $users){

New-Object -TypeName PSobject -Property @{

SAM=$dguser.SamAccountName

Group=$group.name

}

}

}|Export-Csv -Path "c:\Export\DGusers.csv"

#TYPE System.Management.Automation.PSCustomObject

"SAM","Group"

"user1","DG1"

"user2","DG1"

"user3","DG2"

"user3","DG2"

"user1","DG3"

"user3","DG3"

******************************

4.目标域(导入-通讯组-中-用户)

******************************

&&&&&&&&&&&&&&&&&&&&&&&&&

Exchange Management Shell

&&&&&&&&&&&&&&&&&&&&&&&&&

Import-Csv "C:\Export\DGusers.csv" | ForEach{Add-DistributionGroupMember -Identity $_.Group -Member $_.SAM}