사서함 데이터베이스에서 사서함 정보를 사용하여 Active Directory 계정을 생성하는 방법

 

적용 대상: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1, Exchange Server 2007

마지막으로 수정된 항목: 2007-04-26

Exchange 사서함은 다음과 같은 두 가지 구성 요소로 구성됩니다.

  • Active Directory 디렉터리 서비스 사용자 계정

  • Exchange 사서함 데이터베이스에 저장되는 사서함 데이터

사서함 데이터베이스에 저장되는 데이터에는 해당 사서함에 연결된 사용자 계정에 대한 제한적인 정보가 포함되어 있습니다. 재해가 발생하여 Active Directory 데이터베이스가 손실되고 도메인 컨트롤러에서 Active Directory 백업 또는 시스템 상태 백업을 사용할 수 없는 경우에는 사서함 데이터베이스에 저장된 정보를 사용하여 사용자 계정을 다시 만들 수 있습니다. Microsoft Exchange Server 2003 및 Exchange 2000 Server에서는 사서함 다시 연결 도구(Mbconn.exe)를 사용하여 이 작업을 수행했습니다. Mbconn.exe에 대한 자세한 내용은 Microsoft 기술 자료 문서 271886, Mbconn 유틸리티를 사용하여 정보 저장소 사서함에 대해 Active Directory 계정을 생성하는 방법(How to use the Mbconn utility to generate Active Directory accounts for information store mailboxes)을 참조하십시오.

Exchange Server 2007에서는 Mbconn.exe를 사용할 수 없으므로 Exchange 관리 셸 스크립트를 사용하여 연결이 끊긴 사서함에서 필요한 데이터를 수집해야 합니다. 그런 다음 해당 데이터를 LDIF(LDAP(Lightweight Directory Access Protocol) 데이터 교환 형식) 파일에 저장하고 해당 파일을 Active Directory로 가져올 수 있습니다. LDIF 파일을 Active Directory로 가져오려면 LDIFDE(LDAP 데이터 교환 형식 데이터 Exchange) 도구를 사용해야 합니다. LDIFDE는 Microsoft Windows Server 2003을 실행 중인 컴퓨터에 기본적으로 설치됩니다. 

이 항목에서는 Exchange 관리 셸 스크립트와 LDIFDE 도구를 사용하여 사서함 데이터베이스에 저장된 사서함 정보를 통해 손실된 Active Directory 사용자 계정을 생성하는 방법에 대해 설명합니다.

중요

이 절차에서 사용하는 스크립트는 예제이며 그대로 사용할 수도 있지만 조직의 필요에 맞게 수정할 수도 있습니다.

시작하기 전에

이 절차를 수행하려면 사용하는 계정이 다음을 위임받아야 합니다.

  • Exchange 받는 사람 관리자 역할

  • 적용 가능한 Active Directory 컨테이너에 대한 계정 운영자 역할

사용 권한, 역할 위임 및 Exchange 2007 관리에 필요한 권한에 대한 자세한 내용은 사용 권한 고려 사항을 참조하십시오.

절차를 수행하기 전에 다음 사항을 확인하십시오.

  • 사서함 서버 역할이 지정된 Exchange 2007 서버가 설치되었습니다.

  • 이 서버에 Exchange 2007 사서함 데이터베이스가 복원 및 탑재되었습니다.

  • 새 Active Directory 포리스트를 만들었습니다.

  • 새 Active Directory 포리스트에 있는 복원된 사서함 데이터베이스의 사서함에 일치하는 사용자 계정이 없습니다.

절차

사서함 데이터에서 사용자 계정을 생성하는 절차는 다음과 같은 단계로 구성됩니다.

  1. Exchange 관리 셸 스크립트를 사용하여 연결이 끊긴 사서함에서 필요한 데이터를 수집한 다음 해당 데이터를 LDIF 파일에 저장합니다. 이 단계는 첫 번째 절차에서 설명합니다.

  2. LDIFDE 도구를 사용하여 LDIF 파일을 Active Directory로 가져옵니다. 이 파일은 Active Directory에 사용자 계정을 생성합니다. 이 단계는 두 번째 절차에서 설명합니다.

  3. Exchange 관리 셸을 사용하여 Active Directory로 LDIF 파일을 가져올 때 생성된 사용자 계정에 모든 사서함을 연결합니다. 이 단계는 세 번째 절차에서 설명합니다.

    참고

    이 항목에서 설명하는 모든 단계는 복원된 사서함 데이터베이스를 호스팅하는 Exchange 서버에서 수행해야 합니다.

Exchange 관리 셸 스크립트를 사용하여 연결이 끊긴 사서함에서 필요한 데이터를 수집한 다음 Active Directory로 가져오기 위해 해당 데이터를 LDIF 파일에 저장하려면 다음을 수행합니다.

  1. 다음 스크립트를 사용하여 연결이 끊긴 사서함에서 필요한 데이터를 가져온 다음 해당 데이터를 LDIF 파일에 저장합니다. 다음 코드를 CreateLdifFromDisconnectedMailboxes.ps1 텍스트 파일에 복사한 다음 해당 파일을 Exchange가 설치된 폴더 아래에 있는 Scripts 폴더에 저장합니다. 표준 설치를 수행한 경우 이 폴더의 위치는 C:\Program Files\Microsoft\Exchange Server\Scripts입니다.

    Param(
    [string] $ContainerDN,
    [string] $Database = "",
    [bool] $append = $false
    )
    
    #function to validate input parameters
    function ValidateParams
    {
    $validInputs = $true
    $errorString = ""
    
    if ($ContainerDN -eq "")
    {
    $validInputs = $false
    $errorString += "`nMissing Parameter:  The -ContainerDN parameter is required. Please pass in a valid container in which to create the user accounts."
    }
    
    if (!$ContainerDN.Contains(","))
    {
    $validInputs = $false
    $errorString += "`nInvalid Container DN.  Make sure to enclose the entire DN in double quotes or it will not be parsed properly."
    }
    
    if (!$validInputs)
    {
    Write-error "$errorString"
    }
    
    return $validInputs
    }
    
    #function to get the display name and alias from mailbox data in the Exchange store
    function ExtractDisplayNameAndAlias($obj)
    {
    [string[]]$legacyDNSplit = $obj.LegacyDN.Split('/')
    $alias = $legacyDNSplit[$legacyDNSplit.Length-1].Remove(0,3).ToLower()
    $output = "dn: CN=" + $obj.DisplayName + "," + $ContainerDN + "`r`nchangetype: add`r`nuserAccountControl: 544`r`nmsExchUserAccountControl: 0`r`npwdLastSet: -1`r`ndisplayName: " + $obj.DisplayName + "`r`nobjectClass: user`r`nsAMAccountName: " + $alias + "`r`n"
    write-output $output | out-file -filePath "c:\ldifout.ldf" -append -noClobber
    }
    
    # Function that returns true if the incoming argument is a help request
    function IsHelpRequest
    {
    param($argument)
    return ($argument -eq "-?" -or $argument -eq "-help");
    }
    
    # Function that displays the help related to this script following
    # the same format provided by get-help or <cmdletcall> -?
    function Usage
    {
    @"
    
    NAME:
    CreateLdifFromDisconnectedMailboxes.ps1
    
    SYNOPSIS:
    Finds all disconnected mailboxes on the local server and creates an LDIF file 
    with an entry for each disconnected mailbox user. Use the LDIFDE utility to import this LDIF file to Active Directory, which generates the user accounts. You can then reconnect Mailboxes 
    to these accounts by using the Connect-Mailbox cmdlet. You can
    specify a particular database, or specify no database to search all databases
    on the local server.
    
    This script is mainly used for disaster recovery scenarios where all data except  
    the mailbox databases have been lost.  In these scenarios, without a backup of Active
    Directory, you must re-create the user accounts so they can be 
    connected to existing mailboxes. This is the main objective of this script.
    
    SYNTAX:
    CreateLdifFromDisconnectedMailbox -ContainerDN <AD Container DN> 
    -Database <Identity of Database> -Append `$false|`$true
    
    AD Container DN is a valid Active Directory container in distinguished name format. This value
    must be enclosed in quotes. Database is the Identity parameter of the 
    database. You can retrieve the Identity value for all databases on the local 
    server by running the following cmdlet:
    
    get-mailboxdatabase -server Server01 | fl Identity
    
    Setting -append to `$true tells the script to append data to the current 
    c:\ldifout.ldf file instead of overwriting it. This is the recommended
    setting if you are piping output from other cmdlets to this script. If the
    -append switch is not included, the script runs automatically in overwrite mode.
    
    EXAMPLES:
    
    "Specifying Database ID"
    CreateLdifFromDisconnectedMailbox -ContainerDN "CN=Users,DC=Domain,DC=com" 
    -Database "SERVER\Storage Group\Database"
    
    "Run Against All Stores on Local Server"
    CreateLdifFromDisconnectedMailbox -ContainerDN "CN=Users,DC=Domain,DC=com" 
    
    "Pipe output of another cmdlet into this script"
    get-mailboxdatabase -server SERVER | foreach {CreateLdifFromDisconnectedMailboxes -ContainerDN 
    
    "CN=Users,DC=domain,DC=com" -Database `$_.Identity -append `$true}
    "@
    }
    
    ################################################################
    ##########################BEGIN SCRIPT##########################
    ################################################################
    
    #Check if this is a help request
    $args | foreach { if (IsHelpRequest $_) { Usage; exit; } }
    
    #Delete existing LDIF file if it is there and append is set to false
    if(!$append){$a = remove-item c:\ldifout.ldf -ea SilentlyContinue}
    
    #Validate all input parameters
    $ifValidParams = ValidateParams;
    if (!$ifValidParams) { exit; }
    
    #find all disconnected mailboxes and get required information
    if ($Database -ne "")
    {
    write "Getting disconnected mailboxes for database $Database"
    $getmbxcmd = get-mailboxstatistics -Database $Database | where {$_.DisconnectDate -ne $null}
    }
    else
    {
    write "Getting disconnected mailboxes for all databases on local server."
       $getmbxcmd = get-mailboxstatistics | where {$_.DisconnectDate -ne $null}
    }
    
    #Make sure at least one disconnected mailbox is found; if not, exit script
    if ($getmbxcmd -eq $null) {write "No disconnected mailboxes found.";exit}
    
    #loop through each disconnected mailbox and write entries to the output file
    foreach ($entry in $getmbxcmd)
    {
    ExtractDisplayNameAndAlias $entry
    }
    
    write "LDIF file successfully written to C:\ldifout.ldf."
    
  2. Exchange 관리 셸을 시작하고 다음 명령을 실행합니다.

    CreateLdifFromDisconnectedMailboxes -ContainerDN "<DN of container to place users>"
    

    중요

    ContainerDN 매개 변수로 전달되는 <사용자를 저장할 컨테이너의 DN> 값은 유효한 Active Directory 컨테이너의 DN(고유 이름)이어야 하며 큰따옴표로 묶어야 합니다. 예를 들어 새 사용자 계정을 contoso.com 도메인의 Users OU(조직 구성 단위)에 저장하려면 "CN=Users,DC=contoso,DC=com" 값을 사용해야 합니다.

    위의 명령은 실행되는 서버에서 모든 사서함 데이터베이스를 처리합니다. 특정 사서함 데이터베이스에 대해 스크립트를 실행하려는 경우에는 Database 매개 변수를 사용하여 원하는 데이터베이스를 지정하면 됩니다.

    스크립트 출력이 C 드라이브 루트에 있는 ldifout.ldf 파일에 저장됩니다. 해당 위치에 파일이 이미 있으면 스크립트는 기본적으로 이 파일을 덮어씁니다. Append 매개 변수를 $true로 설정하면 기존 파일에 스크립트를 추가할 수도 있습니다.

    스크립트에 사용되는 구문에 대한 자세한 내용을 보려면 다음 명령을 실행합니다.

    CreateLdifFromDisconnectedMailboxes -?
    

LDIFDE 도구를 사용하여 LDIF 파일을 Active Directory로 가져오려면 다음을 수행합니다.

  1. 명령 프롬프트에 ldifde.exe -i -f C:\ldifout.ldf를 입력하고 Enter 키를 누릅니다.

  2. Active Directory 사용자 및 컴퓨터를 시작합니다.

  3. 파일을 제대로 가져오면 해당 스크립트를 실행할 때 지정한 컨테이너에 사용자가 표시되어야 합니다. 컨테이너에 사용자 계정이 있으면 다음 절차를 진행합니다.

Exchange 관리 셸을 사용하여 사서함을 연결하려면 다음을 수행합니다.

  1. Exchange 관리 셸을 시작합니다.

  2. 다음 명령을 실행하여 특정 사서함 데이터베이스의 모든 사서함을 연결합니다. 이 명령 예제에서는 Server01 서버에 있는 SG1 저장소 그룹의 MBX1 사서함 데이터베이스에 저장된 모든 사서함을 연결하는 것으로 가정합니다.

    Get-MailboxStatistics | Where {$_.DisconnectDate -ne $null} | Connect-Mailbox -Database "Server01\SG1\MBX1"
    
  3. 해당 서버에 있는 모든 추가 사서함 데이터베이스에 대해 2단계를 반복합니다.

  4. IISAdmin(IIS(인터넷 정보 서비스) 관리 서비스)을 다시 시작합니다.

    참고

    클라이언트 액세스 서버 역할이 복구 작업을 수행 중인 서버가 아닌 다른 서버에 설치되어 있는 경우에는 해당 서버에서 IIS 관리 서비스를 다시 시작합니다.

  5. MSExchangeIS(Microsoft Exchange Information Store) 서비스를 다시 시작합니다.

  6. 사용자가 지금 자신의 사서함에 로그온할 수 있는지 확인합니다.

이 문제를 해결하기가 어려운 경우에는 Microsoft 기술 지원 서비스에 문의하십시오. 지원 서비스에 문의하는 방법에 대한 자세한 내용은 Microsoft 도움말 및 지원 웹 사이트의 문의처 페이지를 참조하십시오.

자세한 내용

Exchange 2007의 재해 복구에 대한 자세한 내용은 재해 복구를 참조하십시오.

재해에 대비하여 준비할 수 있는 작업에 대한 자세한 내용은 재해의 영향을 최소화하기 위한 유용한 정보를 참조하십시오.

Mbconn.exe 도구를 사용하여 Exchange 2003 또는 Exchange 2000에서 이 항목에서 설명한 것과 동일한 결과를 얻을 수 있는 방법에 대한 자세한 단계는 Microsoft 기술 자료 문서 271886, Mbconn 유틸리티를 사용하여 정보 저장소 사서함에 대해 Active Directory 계정을 생성하는 방법(How to use the Mbconn utility to generate Active Directory accounts for information store mailboxes)을 참조하십시오.