> 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/enumeration/active-directory-powershell-module.md).

# Módulo PowerShell do Active Directory

### Objetivo

O módulo Active Directory permite usar comandos como:

{% code overflow="wrap" %}

```powershell
Get-ADDomain
Get-ADUser
Get-ADComputer
Get-ADDomainController
```

{% endcode %}

Em um controlador de domínio, esse módulo geralmente está disponível por padrão.

Em uma máquina Windows 10 convencional, muitas vezes ele não está instalado.

<figure><img src="/files/8ad9d868fadca4aa711d0d0d21d72637dbcb9e4f" alt=""><figcaption></figcaption></figure>

### Carregar informações do domínio

No controlador de domínio:

```bash
Get-ADDomain
```

Este comando retorna informações importantes, como:

* o nome do domínio;
* o SID do domínio;
* o modo funcional do domínio;
* a floresta;
* o controlador de domínio primário;
* o mestre de infraestrutura;
* informações de configuração do AD.

### Use o módulo em uma máquina sem RSAT

A DLL pode ser obtida no DC:

{% code overflow="wrap" %}

```bash
C:/Windows/Microsoft.Net/assembly/GAC_64/Microsoft.ActiveDirectory.Management/v4.0_10.0.0.0__31bf3856ad364e35/Microsoft.ActiveDirectory.Management.dll
```

{% endcode %}

Em seguida, nós a copiamos para `WS02`, e então a importamos:

{% code overflow="wrap" %}

```powershell
Import-Module ./Microsoft.ActiveDirectory.Management.dll
```

{% endcode %}

Depois, podemos testar:

{% code overflow="wrap" %}

```powershell
Get-ADDomain
```

{% endcode %}

<figure><img src="/files/274ecf01f94d2c4f1d883a2e7760d6a6f7ed9219" alt=""><figcaption></figcaption></figure>

### Alternativa com PowerView

Sem um módulo do Active Directory, o PowerView oferece comandos equivalentes.

Obter informações do domínio:

{% code overflow="wrap" %}

```powershell
Get-NetDomain
```

{% endcode %}

Obter a política do domínio:

{% code overflow="wrap" %}

```powershell
Get-DomainPolicy
```

{% endcode %}

Exibir a `SystemAccess` seção:

{% code overflow="wrap" %}

```powershell
(Get-DomainPolicy)."SystemAccess"
```

{% endcode %}

Isso permite obter informações como:

* política de senha;
* bloqueio de conta;
* a idade máxima da senha;
* configurações de segurança do domínio.


---

# 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/enumeration/active-directory-powershell-module.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.
