Share via


Exchange 2007 사서함을 Exchange Online 메일 사용 가능 사용자로 변환

단계적 마이그레이션을 완료한 후 온-프레미스 사서함을 메일 사용 가능 사용자로 변환하여 온-프레미스 사용자가 클라우드 사서함에 자동으로 연결할 수 있도록 합니다.

사서함을 메일 사용 가능 사용자로 변환하는 이유

Active Directory를 사용하여 온-프레미스 조직의 클라우드 기반 사용자를 관리할 수 있도록 마이그레이션된 온-프레미스 사서함을 MEU(메일 사용 사용자)로 변환해야 합니다.

미리 구성된 Exchange 마이그레이션에서 사서함이 클라우드로 마이그레이션된 후 다음과 같은 두 가지 일이 발생합니다.

  • 사용자가 온-프레미스 사서함과 클라우드 사서함을 보유합니다.
  • 사용자의 온-프레미스 사서함으로 전송된 메일은 클라우드 사서함으로 전달됩니다. 이 문제는 마이그레이션 프로세스 중에 온-프레미스 사서함의 TargetAddress 속성에 클라우드 사서함의 원격 라우팅 주소가 포함되어 있기 때문입니다. 사용자는 자신의 전자 메일에 액세스하려면 클라우드 사서함에 연결해야 합니다.

이 동작으로 인해 다음과 같은 문제가 발생합니다.

  • 사용자는 Microsoft Outlook에서 클라우드 사서함에 연결할 수 없습니다. 온-프레미스 조직의 자동 검색 서비스는 여전히 온-프레미스 사서함에 연결하려고 합니다. 모든 사용자가 마이그레이션될 때까지 온-프레미스 자동 검색 CNAME 레코드를 클라우드로 가리킬 수 없습니다.

  • 모든 사서함을 클라우드로 마이그레이션한 후 Exchange를 해제하면 클라우드 사서함에 대한 메시징 관련 사용자 정보가 손실됩니다. 디렉터리 동기화는 온-프레미스 사서함이 더 이상 존재하지 않으므로 클라우드 사서함 개체(예: 프록시 주소)에서 데이터를 제거합니다. 디렉터리 동기화는 데이터를 해당 클라우드 사서함과 일치시킬 수 없습니다.

이 솔루션은 사서함을 클라우드로 마이그레이션한 후 사용자의 온-프레미스 사서함을 MEU(메일 사용 가능 사용자)로 변환하는 것입니다. 온-프레미스 사서함을 MEU로 변환하면 다음 작업이 수행됩니다.

  • 클라우드 기반 사서함의 프록시 주소가 새 MEU에 복사됩니다. Exchange를 해제하는 경우 이러한 프록시 주소는 여전히 Active Directory에 유지됩니다.
  • MEU의 속성을 사용하면 디렉터리 동기화가 MEU와 해당 클라우드 사서함을 일치시킬 수 있습니다.
  • 사용자가 새 Outlook 프로필을 만든 후 자동 검색 서비스에서 MEU를 사용하여 Outlook을 클라우드 사서함에 연결합니다.

MEU를 만들기 위한 PowerShell 스크립트

이 섹션의 스크립트를 사용하여 클라우드 기반 사서함에 대한 정보를 수집하고 Exchange 2007 사서함을 MEU로 변환합니다.

PowerShell 스크립트는 클라우드 사서함에서 정보를 수집하고 CSV 파일에 저장합니다. 먼저 이 스크립트를 실행합니다.

스크립트를 메모장에 복사하고 파일을 ExportO365UserInfo.ps1 저장합니다.

참고

  • PowerShell 스크립트를 실행하기 전에 Exchange Online PowerShell 모듈을 설치해야 합니다. 지침은 Exchange Online PowerShell 모듈 설치 및 유지 관리를 참조하세요. 모듈은 최신 인증을 사용합니다.

  • 일반적으로 조직이 Microsoft 365 또는 Microsoft 365 GCC인 경우 스크립트를 그대로 사용할 수 있습니다. 조직이 Office 365 독일, Microsoft 365 GCC High 또는 Microsoft 365 DoD인 경우 스크립트에서 Connect-ExchangeOnline줄을 편집해야 합니다. 특히 ExchangeEnvironmentName 매개 변수와 조직 유형에 적절한 값을 사용해야 합니다. 자세한 내용은 Exchange Online PowerShell에 연결의 예를 참조하세요.

Param($migrationCSVFileName = "migration.csv")
function O365Logon
{
    #Check for current open O365 sessions and allow the admin to either use the existing session or create a new one
    $session = Get-PSSession | ?{$_.ConfigurationName -eq 'Microsoft.Exchange'}
    if($session -ne $null)
    {
        $a = Read-Host "An open session to Exchange Online PowerShell already exists. Do you want to use this session?  Enter y to use the open session, anything else to close and open a fresh session."
        if($a.ToLower() -eq 'y')
        {
            Write-Host "Using existing Exchange Online Powershell session." -ForeGroundColor Green
            return
        }
        Disconnect-ExchangeOnline -Confirm:$false
    }
    Import-Module ExchangeOnlineManagement
    Connect-ExchangeOnline -Prefix "Cloud"
}
function Main
{
    #Verify the migration CSV file exists
    if(!(Test-Path $migrationCSVFileName))
    {
        Write-Host "File $migrationCSVFileName does not exist." -ForegroundColor Red
        Exit
    }
    #Import user list from migration.csv file
    $MigrationCSV = Import-Csv $migrationCSVFileName

    #Get mailbox list based on email addresses from CSV file
    $MailBoxList = $MigrationCSV | %{$_.EmailAddress} | Get-CloudMailbox
    $Users = @()

    #Get LegacyDN, Tenant, and On-Premises Email addresses for the users
    foreach($user in $MailBoxList)
    {
        $UserInfo = New-Object System.Object

        $CloudEmailAddress = $user.EmailAddresses | ?{($_ -match 'onmicrosoft') -and ($_ -match 'smtp:')}
        if ($CloudEmailAddress.Count -gt 1)
        {
            $CloudEmailAddress = $CloudEmailAddress[0].ToString().ToLower().Replace('smtp:', '')
            Write-Host "$user returned more than one cloud email address. Using $CloudEmailAddress" -ForegroundColor Yellow
        }
        else
        {
            $CloudEmailAddress = $CloudEmailAddress.ToString().ToLower().Replace('smtp:', '')
        }

        $UserInfo | Add-Member -Type NoteProperty -Name LegacyExchangeDN -Value $user.LegacyExchangeDN
        $UserInfo | Add-Member -Type NoteProperty -Name CloudEmailAddress -Value $CloudEmailAddress
        $UserInfo | Add-Member -Type NoteProperty -Name OnPremiseEmailAddress -Value $user.PrimarySMTPAddress.ToString()
        $UserInfo | Add-Member -Type NoteProperty -Name MailboxGUID -Value $user.ExchangeGUID
        $Users += $UserInfo
    }
    #Check for existing csv file and overwrite if needed
    if(Test-Path ".\cloud.csv")
    {
        $delete = Read-Host "The file cloud.csv already exists in the current directory. Do you want to delete it?  Enter y to delete, anything else to exit this script."
        if($delete.ToString().ToLower() -eq 'y')
        {
            Write-Host "Deleting existing cloud.csv file" -ForeGroundColor Red
            Remove-Item ".\cloud.csv"
        }
        else
        {
            Write-Host "Will NOT delete current cloud.csv file. Exiting script." -ForeGroundColor Green
            Exit
        }
    }
    $Users | Export-CSV -Path ".\cloud.csv" -notype
    (Get-Content ".\cloud.csv") | %{$_ -replace '"', ''} | Set-Content ".\cloud.csv" -Encoding Unicode
    Write-Host "CSV File Successfully Exported to cloud.csv" -ForeGroundColor Green
}
O365Logon
Main

Visual Basic 스크립트는 온-프레미스 Exchange 2003 사서함을 MEU로 변환합니다. PowerShell 스크립트를 실행한 후 이 스크립트를 실행하여 클라우드 사서함에서 정보를 수집합니다.

스크립트를 메모장에 복사하고 파일을 Exchange2007MBtoMEU.vbs 저장합니다.

param($DomainController = [String]::Empty)
function Main
{
    #Script Logic flow
    #1. Pull User Info from cloud.csv file in the current directory
    #2. Lookup AD Info (DN, mail, proxyAddresses, and legacyExchangeDN) using the SMTP address from the CSV file
    #3. Save existing proxyAddresses
    #4. Add existing legacyExchangeDN's to proxyAddresses
    #5. Delete Mailbox
    #6. Mail-Enable the user using the cloud email address as the targetAddress
    #7. Disable RUS processing
    #8. Add proxyAddresses and mail attribute back to the object
    #9. Add msExchMailboxGUID from cloud.csv to the user object (for offboarding support)

    if($DomainController -eq [String]::Empty)
    {
        Write-Host "You must supply a value for the -DomainController switch" -ForegroundColor Red
        Exit
    }

    $CSVInfo = Import-Csv ".\cloud.csv"
    foreach($User in $CSVInfo)
    {
        Write-Host "Processing user" $User.OnPremiseEmailAddress -ForegroundColor Green
        Write-Host "Calling LookupADInformationFromSMTPAddress" -ForegroundColor Green
        $UserInfo = LookupADInformationFromSMTPAddress($User)

        #Check existing proxies for On-Premises and Cloud Legacy DN's as x500 proxies. If not present add them.
        if($UserInfo.ProxyAddresses -notcontains ("X500:"+$UserInfo.CloudLegacyDN))
        {
            $X500Proxy = "x500:" + $UserInfo.CloudLegacyDN
            Write-Host "Adding $X500Proxy to EmailAddresses" -ForegroundColor Green
            $UserInfo.ProxyAddresses.Add($X500Proxy)
        }
        if($UserInfo.ProxyAddresses -notcontains ("X500:"+$UserInfo.LegacyDN))
        {
            $X500Proxy = "x500:" + $UserInfo.LegacyDN
            Write-Host "Adding $X500Proxy to EmailAddresses" -ForegroundColor Green
            $UserInfo.ProxyAddresses.Add($X500Proxy)
        }

        #Disable Mailbox
        Write-Host "Disabling Mailbox" -ForegroundColor Green
        Disable-Mailbox -Identity $UserInfo.OnPremiseEmailAddress -DomainController $DomainController -Confirm:$false

        #Mail Enable
        Write-Host "Enabling Mailbox" -ForegroundColor Green
        Enable-MailUser  -Identity $UserInfo.Identity -ExternalEmailAddress $UserInfo.CloudEmailAddress -DomainController $DomainController

        #Disable RUS
        Write-Host "Disabling RUS" -ForegroundColor Green
        Set-MailUser -Identity $UserInfo.Identity -EmailAddressPolicyEnabled $false -DomainController $DomainController

        #Add Proxies and Mail
        Write-Host "Adding EmailAddresses and WindowsEmailAddress" -ForegroundColor Green
        Set-MailUser -Identity $UserInfo.Identity -EmailAddresses $UserInfo.ProxyAddresses -WindowsEmailAddress $UserInfo.Mail -DomainController $DomainController

        #Set Mailbox GUID. Need to do this via S.DS as Set-MailUser doesn't expose this property.
        $ADPath = "LDAP://" + $DomainController + "/" + $UserInfo.DistinguishedName
        $ADUser = New-Object -TypeName System.DirectoryServices.DirectoryEntry -ArgumentList $ADPath
        $MailboxGUID = New-Object -TypeName System.Guid -ArgumentList $UserInfo.MailboxGUID
        [Void]$ADUser.psbase.invokeset('msExchMailboxGUID',$MailboxGUID.ToByteArray())
        Write-Host "Setting Mailbox GUID" $UserInfo.MailboxGUID -ForegroundColor Green
        $ADUser.psbase.CommitChanges()

        Write-Host "Migration Complete for" $UserInfo.OnPremiseEmailAddress -ForegroundColor Green
        Write-Host ""
        Write-Host ""
    }
}

function LookupADInformationFromSMTPAddress($CSV)
{
    $Mailbox = Get-Mailbox $CSV.OnPremiseEmailAddress -ErrorAction SilentlyContinue

    if($Mailbox -eq $null)
    {
        Write-Host "Get-Mailbox failed for" $CSV.OnPremiseEmailAddress -ForegroundColor Red
        continue
    }

    $UserInfo = New-Object System.Object

    $UserInfo | Add-Member -Type NoteProperty -Name OnPremiseEmailAddress -Value $CSV.OnPremiseEmailAddress
    $UserInfo | Add-Member -Type NoteProperty -Name CloudEmailAddress -Value $CSV.CloudEmailAddress
    $UserInfo | Add-Member -Type NoteProperty -Name CloudLegacyDN -Value $CSV.LegacyExchangeDN
    $UserInfo | Add-Member -Type NoteProperty -Name LegacyDN -Value $Mailbox.LegacyExchangeDN
    $ProxyAddresses = New-Object Microsoft.Exchange.Data.ProxyAddressCollection
    $ProxyAddresses = $Mailbox.EmailAddresses
    $UserInfo | Add-Member -Type NoteProperty -Name ProxyAddresses -Value $ProxyAddresses
    $UserInfo | Add-Member -Type NoteProperty -Name Mail -Value $Mailbox.WindowsEmailAddress
    $UserInfo | Add-Member -Type NoteProperty -Name MailboxGUID -Value $CSV.MailboxGUID
    $UserInfo | Add-Member -Type NoteProperty -Name Identity -Value $Mailbox.Identity
    $UserInfo | Add-Member -Type NoteProperty -Name DistinguishedName -Value (Get-User $Mailbox.Identity).DistinguishedName

    $UserInfo
}
Main

온-프레미스 사서함을 MEU로 변환하기 위한 설정 단계

다음 단계에 따라 프로세스를 완료합니다.

  1. 마이그레이션 일괄 처리를 실행하는 데 사용되는 ExportO365UserInfo.ps1, Exchange2007MBtoMEU.ps1 및 CSV 파일을 온-프레미스 서버의 같은 디렉터리에 복사합니다.

  2. 마이그레이션 CSV 파일의 이름을 migration.csv로 바꿉니다.

  3. Exchange 관리 셸에서 다음 명령을 실행합니다. 이 스크립트에서는 CSV 파일이 같은 디렉터리에 있고 이름이 migration.csv라고 가정합니다.

    .\ExportO365UserInfo.ps1
    

    기존 세션을 사용하거나 새 세션을 열라는 메시지가 나타납니다.

  4. n을 입력하고 Enter 키를 눌러 새 세션을 엽니다.

    스크립트가 실행된 다음 Cloud.csv 파일을 현재 작업 디렉터리에 저장합니다.

  5. 클라우드 기반 조직의 관리자 자격 증명을 입력한 다음 확인을 클릭합니다.

  6. 새 Exchange 관리 셸 세션에서 다음 명령을 실행합니다. 이 명령에서는 ExportO365UserInfo.ps1 및 Cloud.csv가 같은 디렉터리에 있다고 가정합니다.

    .\Exchange2007MBtoMEU.ps1 <FQDN of on-premises domain controller>
    

    예:

    .\Exchange2007MBtoMEU.ps1 DC1.contoso.com
    

    스크립트는 Cloud.csv에 포함된 모든 사용자에 대해 온-프레미스 사서함을 MEU로 변환합니다.

  7. 새 MEU가 만들어졌는지 확인합니다. Active Directory 사용자 및 컴퓨터 다음 단계를 수행합니다.

    1. 작업>찾기를 클릭합니다.

    2. Exchange 탭을 클릭합니다.

    3. Show only Exchange recipients(Exchange 받는 사람만 표시)를 선택한 다음 외부 전자 메일 주소가 있는 사용자를 선택합니다.

    4. 지금 찾기를 클릭합니다.

      MEU로 변환된 사서함이 검색 결과 아래에 나열됩니다.

  8. Active Directory 사용자 및 컴퓨터, ADSI 편집 또는 Ldp.exe 사용하여 다음 MEU 속성이 올바른 정보로 채워져 있는지 확인합니다.

    • Legacyexchangedn
    • mail
    • msExchMailboxGuid
    • proxyAddresses
    • Targetaddress