Active Directory
Export, Compare, and Synchronize Active Directory Schemas
John Policelli
At a Glance:
-
Using LDIFDE to export the schema from the source forest
-
Comparing schemas with the Active Directory DS/LDS Schema Analyzer
-
Import your schema into the target forest

Contents
Each Active Directory forest has its own schema, which defines the objects and attributes that the directory service uses to store data.
When organizations have multiple Active Directory forests, IT administrators have to manage multiple Active Directory schemas; ensuring consistency between schemas is vital when managing multiple forests.
In this article, I will walk you through a streamlined process to manage multiple Active Directory schemas.
Organizations may deploy more than one production Active Directory forests for a variety of business or technical reasons.
Often, additional Active Directory forests are deployed well after the production forest has been deployed.
In some cases, this occurs years later.
Active Directory was released nearly a decade ago.
Over the years, organizations have undoubtedly made numerous schema modifications to their production forest.
Identifying these schema modifications to the forest is a challenging task.
It's even more difficult to ensure that the schema modifications that were previously made to the production forest are made in new testing forests in a consistent manner.
In this article, I focus on a scenario in which you are deploying a new user acceptance testing ( UAT ) Active Directory forest that will be used by end users to test applications that leverage Active Directory for authentication and authorization.
Five custom attributes exist in your production Active Directory schema, and you need to ensure that the schema from the source production forest is consistent with the new target UAT forest.
There are a number of scenarios, however, in which you can use the process I discuss in this article to streamline the management of multiple schemas.
For more on this, see the sidebar "The Flexibility of Schema Synchronization and Comparison."
Exporting the Schema from the Source Forest
The first step is to export the schema from the source forest.
This is required so that you can later compare the source forest's schema with the target forest's schema to decide which attributes and classes to synchronize.
The LDIFDE command-line tool, which ships with Windows Server 2003 and Windows Server 2008, can be used to export the schema from the source forest.
This tool creates a file that is formatted with the LDAP Data Interchange Format (LDIF).
No special permissions are required to export the schema from the source forest, and any domain user can perform this task.
To export the schema from the source forest, do the following:
-
Log on to a member server or a domain controller.
-
Open a Command Prompt window.
-
Type the following into the Command Prompt window:
ldifde -f PRODSchema.ldif -d CN=Schema,CN=Configuration,DC=WS08DOMAIN01,DC=local
-
Press Enter.
Figure 1 shows the output you'll see from this command.
Figure 1 Exporting the Schema from the Source Forest
In this command, the -f PRODSchema.ldif parameter tells LDIFDE to write the output to a file called PRODSchema.ldif.
The -d CN=Schema,CN=Configuration,DC=WS03DOMAIN01,DC=local parameter tells LDIFDE to use the schema partition as the root of the LDAP search.
The DC=WS08DOMAIN01,DC=local part of the command must be replaced with the distinguished name of the forest root domain in your source forest.
Figure 2 Load target schema window
Compare the Active Directory Schemas
Now that you have exported the schema from the source forest, you are ready to compare this schema with that in the target forest.
This step allows you to identify any attributes and classes that exist in the source forest but do not exist in the target forest.
Windows Server 2008 includes the AD DS/LDS Schema Analyzer tool when the Active Directory Lightweight Directory Services server role is installed.
It can be used to compare schemas in a number of different ways.
Note that this tool was previously called the AD Schema Analyzer in Windows Server 2003.
In this article, I refer to it as the AD DS/LDS Schema Analyzer since my examples are using Windows Server 2008.
The steps in the comparison and export, however, can also be performed using the Windows Server 2003 version of this tool.
To compare the Active Directory schemas of the source and target forests, do the following:
-
Log on to a member server or a domain controller that has AD LDS installed and belongs to a domain in the target forest.
-
Find the PRODSchema.ldif file that was created in the previous section and copy it to the server you log on to.
-
Go to Start, click Run, and type the following: C:\WINDOWS\ADAM\ADSchemaAnalyzer.exe
-
Hit Enter and the AD DS/LDS Schema Analyzer will open.
-
On the File menu of the AD DS/LDS Schema Analyzer window, click Load target schema.
-
In the Load target schema window, shown in
Figure 2
, click the Load LDIF button.
-
Browse to the location of the LDIF file and click Open.
-
The LDIF file will be imported into the AD DS/LDS Schema Analyzer.
-
On the File menu, click Load base schema.
-
In the Load base schema window, enter a domain controller to connect to in the Server[:port] field, a username, a password, and a domain, as shown in
Figure 3 .
-
Click Ok.
-
To filter for the non-present elements, select Hide present elements from the Schema menu.
The missing elements will be listed under the Attributes node, as shown in Figure 5.
-
Expand the Attributes node and the present and non-present elements (attributes and classes) will be listed, by default.
The attributes that are consistent between forests appear with a checkmark in the box beside the element name, as shown in Figure 4.
The elements that exist in the source forest, but are missing from the target forest appear with an empty box.
Figure 3 Load base schema window
Figure 4 Present and missing attributes
Figure 5 Viewing only the missing elements
Figure 6 Mark non-present elements you want to include
Create an LDIF File with the Missing Elements
Now you have completed a comparison of the Active Directory schemas and identified the elements (classes and attributes) that exist in the source forest but do not exist in the target forest.
You now have to create another LDIF file that will contain these missing elements.
This new LDIF file will be used to import the missing elements into the target schema.
You can use the AD DS/LDS Schema Analyzer to create an LDIF that contains the missing elements, by doing the following:
-
To include all missing elements in the LDIF file, on the Schema menu in the AD DS/LDS Schema Analyzer window, click Mark all non-present elements as included, and then click OK on the confirmation.
To control which missing elements are included in the LDIF file, click the box beside each element you want to include.
A plus (+) sign will be added beside the element, as shown in Figure 6.
-
On the File menu in the AD DS/LDS Schema Analyzer, click Create LDIF file.
-
In the Select LDIF file window, enter a location and filename for the LDIF file and click Save.
Import the Schema into the Target Forest
The final step in this process is to import the Active Directory schema into the target forest.
The LDIFDE tool can be used to import the missing elements from the source forest into the target forest.
As previously mentioned, the missing elements are contained in the LDIF file that was just created by the AD DS/LDS Schema Analyzer.
To import the Active Directory schema into the target forest, use an account that is a member of the Enterprise Admins and Schema Admins groups to perform the following tasks:
-
Log on to the domain controller that holds the schema Master Operations Master role.
-
Open a Command Prompt window.
-
In the Command Prompt window, type the following:
ldifde -i -f MissingElements.ldf -c dc=X
DC=WS08DOMAIN02,DC=net
-
Hit Enter.
In this command, the -i parameter tells LDIFDE to perform an import.
The -f MissingElements.ldf parameter tells LDIFDE to import from a file called MissingElements.ldf.
The -c dc=X DC=WS08DOMAIN02,DC=net parameter tells LDIFDE to replace all instances of dc=X with DC=WS08DOMAIN02, DC=net.
The DC=WS08DOMAIN02,DC=net part of the command must be replaced with the distinguished name of the forest root domain in your target forest.
Wrapping Up
At this point, the schema in the target forest has been extended to include the missing elements.
Active Directory schema management is a complex task.
And it becomes even more complex when multiple Active Directory forests are deployed in your environment.
However, by using the process explained in this article, you can streamline the management of multiple Active Directory schemas and ensure you have a consistent schema across all your forests.
John Policelli (Microsoft MVP for Directory Services, MCTS, MCSA, ITSM, iNet+, Network+, and A+) is a solutions-focused IT consultant with over a decade of experience in architecture, security, strategic planning, and disaster recovery planning.
John has spent the past 9 years focused on Identity and Access Management and providing thought leadership for some of the largest installations of Active Directory in Canada.
You can reach him via his blog at
policelli.com/blog
.
|
O Active Directory
Exportar, comparar e sincronizar o Active Directory esquemas
John Policelli
Visão geral:
-
Usando o LDIFDE para exportar o esquema de floresta de origem
-
Comparação de esquemas com o analisador de esquema de DS/LDS Directory Active
-
Importar o esquema de floresta de destino

Conteúdo
Cada floresta do Active Directory possui seu próprio esquema, que define objetos e atributos que usa o serviço de diretório para armazenar dados.
Quando as organizações têm várias florestas do Active Directory, os administradores de TI precisam gerenciar vários esquemas do Active Directory; é fundamental garantir a consistência entre esquemas durante o gerenciamento de várias florestas.
Neste artigo, irá orientá-lo um processo simplificado para gerenciar vários esquemas do Active Directory.
As organizações podem implantar mais florestas de Active Directory de produção para uma variedade de negócios ou motivos técnicos.
Em geral, adicionais florestas do Active Directory são implantadas bem após a floresta de produção ter sido implantada.
Em alguns casos, isso ocorre anos mais tarde.
O Active Directory foi lançado quase uma década atrás.
Com o passar dos anos, organizações, indubitavelmente, fez várias modificações do esquema para sua floresta de produção.
Identificar essas modificações de esquema para a floresta é uma tarefa desafiadora.
É ainda mais difícil garantir que as modificações de esquema feitas anteriormente a floresta de produção são feitas em novas florestas de testes de maneira consistente.
Neste artigo, eu concentrar em um cenário no qual você estiver implantando uma novo aceitação do usuário teste floresta de (UAT) Active Directory que será usada pelos usuários finais para testar aplicativos que utilizam o Active Directory para autenticação e autorização.
Cinco atributos personalizados existem no esquema do Active Directory de produção, e você precisará garantir que o esquema de floresta de produção de origem é consistente com o novo destino UAT floresta.
Há um número de cenários, no entanto, no qual você pode usar o processo discutidos neste artigo para simplificar o gerenciamento de vários esquemas.
Para saber mais sobre isso, consulte a barra lateral "a flexibilidade de sincronização de esquema e de comparação."
Exportar o esquema da floresta de origem
A primeira etapa é exportar o esquema de floresta de origem.
Isso é necessário para que você pode comparar posteriormente o esquema da floresta de origem com esquema da floresta de destino para decidir quais atributos e classes para sincronizar.
A ferramenta de linha de comando LDIFDE, fornecido com o Windows Server 2003 e Windows Server 2008, pode ser usada para exportar o esquema de floresta de origem.
Essa ferramenta cria um arquivo que está formatado com LDIF (LDAP Data Interchange Format).
Nenhuma permissão especial é necessários para exportar o esquema de floresta de origem, e qualquer usuário do domínio pode executar essa tarefa.
Para exportar o esquema de floresta de origem, faça o seguinte:
-
Fazer logon em um servidor membro ou um controlador de domínio.
-
Abra uma janela de prompt de comando.
-
Digite o seguinte na janela de prompt de comando:
ldifde -f PRODSchema.ldif -d CN=Schema,CN=Configuration,DC=WS08DOMAIN01,DC=local
-
Pressione digite.
A Figura 1 mostra a saída que será exibida desse comando.
Figura 1 exportando o esquema da floresta de origem
Nesse comando, o parâmetro de PRODSchema.ldif -f informa LDIFDE para gravar a saída em um arquivo chamado PRODSchema.ldif.
O -d CN = Schema, CN = Configuration, DC = WS03DOMAIN01, DC = local parâmetro informa o LDIFDE para usar a partição de esquema como a raiz da pesquisa LDAP.
O controlador de domínio = WS08DOMAIN01, DC = parte local do comando deve ser substituído pelo nome distinto do domínio raiz da floresta na sua floresta de origem.
A Figura 2 janela do esquema de destino de carga
Comparar os esquemas XML Active Directory
Agora que você tiver exportado o esquema da floresta de origem, você estará pronto para comparar este esquema com isso na floresta de destino.
Esta etapa permite você a identificar os atributos e classes que existem no floresta de origem, mas não existem na floresta de destino.
O Windows Server 2008 inclui a ferramenta Analisador de esquema do AD DS/LDS quando a função de servidor de serviços do Active Directory Lightweight é instalada.
Ele pode ser usado para comparar os esquemas de várias maneiras diferentes.
Observe que essa ferramenta era anteriormente chamada o analisador de esquema do AD no Windows Server 2003.
Neste artigo, eu referir a ele como o analisador de esquema do AD DS/LDS como meus exemplos estiver usando o Windows Server 2008.
As etapas a comparação e a exportação, no entanto, podem também ser executadas usando a versão do Windows Server 2003 dessa ferramenta.
Para comparar os esquemas do Active Directory das florestas origem e de destino, faça o seguinte:
-
Fazer logon no servidor membro ou um controlador de domínio tem AD LDS instalado e pertence a um domínio na floresta de destino.
-
Localize o arquivo PRODSchema.ldif que foi criado na seção anterior e copie-ao fazer logon no servidor.
-
Vá para Iniciar, clique em Executar e digite o seguinte: C:\WINDOWS\ADAM\ADSchemaAnalyzer.exe
-
ENTER visita e a análise de esquema do AD DS/LDS serão aberto.
-
No menu arquivo da janela do analisador de esquema do AD DS/LDS, clique em esquema de destino de carga.
-
Na janela de esquema de destino de carga, mostrado na
A Figura 2
, clique no botão carregar LDIF.
-
Navegue até o local do arquivo LDIF e clique em Abrir.
-
O arquivo LDIF será importado para o analisador de esquema do AD DS/LDS.
-
No menu Arquivo, clique em esquema base da carga.
-
Na janela do esquema base carga, insira um controlador de domínio para se conectar no servidor [: porta] campo, um nome de usuário, uma senha e um domínio, como mostrado na
A Figura 3 .
-
Clique em OK.
-
Para filtrar para os elementos não-presente, selecione Ocultar presentes elementos do menu de esquema.
Os elementos ausentes serão listados sob o nó de atributos, como mostrado na Figura 5 .
-
Expanda o nó de atributos e os elementos presentes e não-presente (atributos e classes) serão listados, por padrão.
Os atributos que são consistentes entre florestas exibido com uma marca de seleção na caixa ao lado o nome do elemento, conforme mostrado na Figura 4 .
Os elementos que existem na floresta de origem, mas estão faltando na floresta de destino aparecem com uma caixa vazia.
A Figura 3 carga esquema base janela
A Figura 4 atributos presentes e ausentes
A Figura 5 exibindo apenas os elementos ausentes
A Figura 6 marcar elementos de não-presente que você deseja incluir
Criar um arquivo LDIF com os elementos ausentes
Agora você já concluída uma comparação dos esquemas do Active Directory e identificou os elementos (classes e atributos) que existem na floresta de origem mas não existem na floresta de destino.
Agora você precisa criar outro arquivo LDIF que conterá esses elementos ausentes.
Esse novo arquivo LDIF será usado para importar os elementos ausentes para o esquema de destino.
Você pode usar o Analisador de esquema do AD DS/LDS para criar um LDIF que contém os elementos ausentes, fazendo o seguinte:
-
Para incluir todos os elementos de ausentes no arquivo LDIF, no menu esquema na janela do analisador de esquema do AD DS/LDS, clique em Marcar Todos os não-presente elementos como incluído e, em seguida, clique em OK na confirmação.
Para controlar quais elementos ausentes são incluídos no arquivo LDIF, clique na caixa ao lado de cada elemento que deseja incluir.
A mais (+) sinal será adicionado ao lado do elemento, como mostrado na Figura 6 .
-
No menu Arquivo no analisador de esquema do AD DS/LDS, clique em arquivo LDIF criar.
-
Na janela do arquivo LDIF selecionar, insira um local e nome de arquivo para o arquivo LDIF e clique em Salvar.
Importar o esquema para a floresta de destino
A etapa final neste processo é importar o esquema do Active Directory para a floresta de destino.
A ferramenta LDIFDE pode ser usada para importar os elementos ausentes de floresta de origem para a floresta de destino.
Como mencionado anteriormente, os elementos ausentes são contidos no arquivo LDIF apenas criado pelo analisador de esquema do AD DS/LDS.
Para importar o esquema do Active Directory para a floresta de destino, use uma conta que seja membro dos grupos Administradores de empresa e Administradores de esquemas para executar as seguintes tarefas:
-
Faça logon no controlador de domínio que contém o esquema de função de mestre de operações de mestre.
-
Abra uma janela de prompt de comando.
-
Na janela prompt de comando, digite o seguinte:
ldifde -i -f MissingElements.ldf -c dc=X
DC=WS08DOMAIN02,DC=net
-
Digite a ocorrência.
Nesse comando, a opção -i parâmetro informa o LDIFDE para executar uma importação.
O parâmetro de MissingElements.ldf -f informa o LDIFDE para importar de um arquivo chamado MissingElements.ldf.
O - c dc = X DC = WS08DOMAIN02, controlador de domínio = net parâmetro informa o LDIFDE para substituir todas as ocorrências de dc = com controladores de domínio = WS08DOMAIN02, DC = net.
O controlador de domínio = WS08DOMAIN02, DC = net parte do comando deve ser substituído pelo nome distinto do domínio raiz da floresta em sua floresta de destino.
Quebra automática para cima
Neste ponto, o esquema na floresta de destino foi estendido para incluir os elementos ausentes.
Gerenciamento de esquema Directory ativo é uma tarefa complexa.
E se tornar ainda mais complexo quando várias florestas do Active Directory são implantadas em seu ambiente.
No entanto, usando o processo explicado neste artigo, você pode simplificar o gerenciamento de vários esquemas do Active Directory e garantir que você tenha um esquema consistente em todas as florestas.
John Policelli (MVP da Microsoft para Directory Services, MCTS MCSA com certificação, ITSM, iNet +, Network + e A +) é consultor de TI da concentra-se de soluções com uma década de experiência em arquitetura, segurança, planejamento estratégico e planejamento de recuperação de desastres.
John passou passado anos 9 voltada para gerenciamento de identidades e acesso e fornecer planejado liderança para alguns das instalações maiores do Active Directory no Canadá.
Você pode contatá-lo pelo seu blog em
policelli.com/blog
.
|