> 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/remote-sam-enumeration.md).

# Enumeração remota do SAM

### Princípio

SAM significa **Gerenciador de Contas de Segurança**.

Ele contém informações sobre:

* contas locais;
* grupos locais;
* pertencimentos a grupos locais.

Em versões mais antigas do Windows, antes do Windows 10 e do Windows Server 2016, muitas vezes era possível enumerar remotamente certas informações do SAM sem privilégios elevados.

### Enumerar grupos locais de uma máquina remota

Com PowerView:

```powershell
Get-NetLocalGroup -ComputerName WS02
```

Este comando tenta recuperar os grupos locais presentes em `WS02`.

### Alternativa sem PowerView

Com PowerShell Remoting:

```powershell
Invoke-Command -ScriptBlock { Get-LocalGroupMember -Group Administrators } -ComputerName WS02
```

Este comando executa `Get-LocalGroupMember` diretamente em `WS02`.

Geralmente, é necessário que:

* o PowerShell Remoting esteja habilitado;
* o usuário tenha os direitos necessários;
* as regras de rede e do firewall permitam isso.

### Ver usuários conectados a uma máquina remota

Com PowerView:

```powershell
Get-NetLoggedon
```

Este comando identifica os usuários atualmente autenticados em uma máquina.

É útil saber:

* onde um usuário está logado;
* se um administrador está ativo em uma máquina;
* quais máquinas podem ser de interesse para análise adicional.

### Ver as sessões abertas na sua máquina

Com PowerView:

```powershell
Get-NetSession
```

Este comando exibe as sessões SMB estabelecidas com a máquina.

Por exemplo, se um usuário tentar acessar:

```bash
//WS01/c$
```

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

Então a conexão pode aparecer nas sessões visíveis.


---

# 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/remote-sam-enumeration.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.
