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}