> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/pt-br/active-directory/lab-setup.md).

# Laboratório de Active Directory

## Instalação e configuração do controlador de domínio (DC)

#### 1. Instalação do Windows Server

* Baixar **Windows Server 2022** ISO

{% embed url="<https://www.microsoft.com/en-us/evalcenter/download-windows-server-2022>" %}

* Selecionar **Windows Server 2022 Standard (Avaliação)**

<figure><img src="/files/cd7a0bc8f0235369b9fc313cba4e63d1b7b6e4f0" alt=""><figcaption></figcaption></figure>

* Instalar o sistema em uma máquina virtual
* Instalador **VMware Tools**

<figure><img src="/files/9b3cd9431dd7725a20ff5f7f187a8e760a85c035" alt=""><figcaption></figcaption></figure>

#### 2. Configuração inicial

* Editar **nome da máquina**

<figure><img src="/files/0a90e69c53e83be24289956cbf82b6baf673bac6" alt=""><figcaption></figcaption></figure>

* Configurar um **endereço IP estático**

<figure><img src="/files/5c8ee91b0d6f7338fe40923575b9dad91d815f46" alt=""><figcaption></figcaption></figure>

#### 3. Instalação de funções

* Instale a função:
  * **Serviços de Domínio do Active Directory (AD DS)**

<figure><img src="/files/1989c56241026f93c122fa37e1cf5c7add745d46" alt=""><figcaption></figcaption></figure>

#### 4. Promoção a controlador de domínio

* Crie um **nova floresta**
* Nome de domínio: `whoami.local`

<figure><img src="/files/e5e401d17548042af1db6451cb0a40844694aa58" alt=""><figcaption></figcaption></figure>

* Reinicie a máquina virtual após a configuração

## Instalação de máquinas Windows 10 no domínio

{% embed url="<https://software.download.prss.microsoft.com/dbazure/Win10_22H2_Spanish_x64v1.iso?t=8faab265-3c5c-460a-ae83-230703b31fd6&P1=1777739675&P2=601&P3=2&P4=ESZ9seUg91b93n2FgqYLYn08u1otAQpm6KUoqKs%2bPfI%2fRGyaR5gC6Z%2bpXtNfLTnRjZwTh0kYwqPjfq0n6jCpj9JH8gba3jIb3OHetCttHy4inx40XJRc7nvkHlJpxfz9q75MgH%2fJNsc3h9ONnCrJ16sUH9PmqmYXPYzSxRQ%2bVltoOyn%2bgWrRLvWlemNQ3BPk6GRx%2bMaFPHPxZcur%2bobP%2fa2%2bCe%2fnm4Ymh2fbIK4KS1e9mXZMCT4hNto6aLXUoAHE6mkoLtIJVAG0wXB%2bo3koJs%2f3Maq8OTxThJdmIAHaASjxSOdRRuqQzOzDiyjQBpmLtvodrW6VrbRBxNGZ9839Bg%3d%3d>" %}

#### 1. Criação das máquinas

* Crie duas máquinas:
  * **WS01**
  * **WS02**

<figure><img src="/files/a2f5f95a94d61c11c7c35713b8b0ecc56055baf3" alt=""><figcaption></figcaption></figure>

#### 2. Configuração da máquina

* Altere os nomes dos computadores:
  * WS01
  * WS02

<figure><img src="/files/2cb7816850a4fcc8c1378be2534928d1c0beda86" alt=""><figcaption></figcaption></figure>

Configure o endereço IP com o DNS apontando para o controlador de domínio:

* DNS : `172.16.0.100`

<figure><img src="/files/a24d0a643576bccbd58e648c943595d27394e8a7" alt=""><figcaption></figcaption></figure>

* Altere **compartilhamento avançado** configurações (rede e descoberta)

<figure><img src="/files/480584dc3e768493bf5557ec87a46c8bbe842539" alt="" width="563"><figcaption></figcaption></figure>

#### 3. Criação de usuários

No **Centro de Administração do Active Directory**:

<figure><img src="/files/8450880526e2484a053edaf81ba71b847fa41c25" alt=""><figcaption></figcaption></figure>

Crie dois usuários:

* user1
* user2

<figure><img src="/files/05063b5f4b9ec7bbe5f7a45ac323507d774cce66" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/9a5ccd8ee92fe03dbf11be6aeef0c85254ae7f68" alt=""><figcaption></figcaption></figure>

#### 4. Integração ao domínio

* Vá para: **Acesso profissional ou educacional**

<figure><img src="/files/11dcb8bb750124f7992f3c32e8cf15b61134c25c" alt=""><figcaption></figcaption></figure>

* Escolha: **Conectar-se a um domínio**
* Digite o nome do domínio: `whoami.local`
* Autenticar com uma conta de domínio

<figure><img src="/files/da605e17c9c1a37036c6c718022eb754e6865e23" alt="" width="535"><figcaption></figcaption></figure>

## Recursos do Active Directory: Usuários, Grupos e UOs

Em **Usuários e Computadores do Active Directory**, você pode gerenciar e modificar a configuração da floresta e dos objetos.

<figure><img src="/files/9e32f54a862998498ebf17b5c9ab964c00a6d584" alt="" width="466"><figcaption></figcaption></figure>

#### Gerenciamento de usuários e UO

<figure><img src="/files/f442d37697ba705ee7c9dae02cb8850be4923cc7" alt="" width="418"><figcaption></figcaption></figure>

#### Exemplo: criação de um departamento

<figure><img src="/files/484fdd2c1800f6c87c182e25e6ea4740c660c630" alt=""><figcaption></figcaption></figure>

Crie um **unidade organizacional (UO)**, por exemplo:

* *Toulouse*
* Mova os usuários existentes para esta UO para organizar a estrutura.

<figure><img src="/files/f8068faae716bbe9188a50379a1221876983c1f5" alt=""><figcaption></figcaption></figure>

#### Gerenciamento de grupos

* Crie grupos, por exemplo:

  * **TI**

  Adicione usuários ao grupo.

<figure><img src="/files/7d7742ded6230fe7a09171c6412cf51e7a65a6dd" alt=""><figcaption></figcaption></figure>

Um grupo pode ser **um membro de outro grupo**.

* Exemplo:
  * O *TI* grupo pode ser membro do *Administrators* grupo

Os usuários então herdam as **permissões** do grupo pai.

<figure><img src="/files/770a61fd6f4bc0a1ecd210b5fe5b32c6d4beacab" alt=""><figcaption></figcaption></figure>

#### Gerenciamento de GPO (Objetos de Política de Grupo)

**GPO** permite gerenciar políticas de configuração.

<figure><img src="/files/eafa81a319031e06b1bfb95bacbdaa752e49fd12" alt=""><figcaption></figcaption></figure>

#### Criação de uma GPO

* Vá para: **Gerenciamento de Política de Grupo**

<figure><img src="/files/75c37edd588f2778febd969adce575c8d07c2440" alt="" width="475"><figcaption></figcaption></figure>

* Clique na UO, por exemplo **Toulouse**
* Criar um novo **GPO**

<figure><img src="/files/ddcf1750e29d243fe9665b0364a9fd251e084e12" alt=""><figcaption></figcaption></figure>

* Editar a política

<figure><img src="/files/fdcce7a48e893b980d2fdef009c96645465c69b3" alt=""><figcaption></figcaption></figure>

#### Tipos de políticas

As GPOs podem ser aplicadas de acordo com:

* **Usuário**
* **Computador**

<figure><img src="/files/592ba4b1d7e77a6095c16e665414e1cd37689e7e" alt=""><figcaption></figcaption></figure>

#### Exemplo: executar um script no início da sessão

* Vá para:/ **Configuração do Usuário → Configurações do Windows → Scripts (Logon)**
* Crie um `script.bat` arquivo com o conteúdo

{% code overflow="wrap" %}

```bash
calc.exe
```

{% endcode %}

<figure><img src="/files/826d684844208d76d99d58fd434e6774008a5d5a" alt=""><figcaption></figcaption></figure>

Resultado: a calculadora abre quando o usuário faz login.

<figure><img src="/files/a585d97d5d4791a47d83ed8387294011c86cf346" alt=""><figcaption></figcaption></figure>

#### Recursos Compartilhados (SMB)

Criação de um compartilhamento

* Vá para:/ **Gerenciador do Servidor → Serviços de Arquivos e de Armazenamento → Compartilhamentos**

<figure><img src="/files/42a08c70b8ed9532dc383d097351c77f7f31d176" alt=""><figcaption></figcaption></figure>

* Crie um novo compartilhamento SMB, por exemplo:
  * Pasta local: `C:\Shares\it`
  * Caminho de rede: `//DC01/it`

<figure><img src="/files/834a386d060b9542ef81673c0f58921972657268" alt=""><figcaption></figcaption></figure>

#### Montagem automática via GPO

Para conectar automaticamente o compartilhamento:

<figure><img src="/files/389b51655a68bef84c1df97969f2b61a37448b68" alt=""><figcaption></figcaption></figure>

* Use um script:

{% code overflow="wrap" %}

```bash
net use t: //172.16.0.100/it
```

{% endcode %}

<figure><img src="/files/0817557a593aea506a1cf2a65ff86851803f8584" alt=""><figcaption></figcaption></figure>

Resultado: a unidade de rede aparece automaticamente nas estações de trabalho.

<figure><img src="/files/ba937795bd2a7469a0542aeb37ef8875a9e54727" alt=""><figcaption></figcaption></figure>

#### Ponto de atenção (segurança)

Preste atenção a estas pastas:

* **NETLOGON**
* **SYSVOL**

<figure><img src="/files/af2d4ad450d68d79245240b494042b7f2ef84845" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/pt-br/active-directory/lab-setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
