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

# 远程 SAM 枚举

面向远程 SAM 枚举的 Active Directory 安全笔记，涵盖枚举、Kerberos、凭据、ACL 滥用、横向移动、利用流程和验证步骤。

### 原则

SAM 指的是 **安全账户管理器**.

它包含以下信息：

* 本地账户；
* 本地组；
* 本地组中的成员关系。

在较旧版本的 Windows 中，在 Windows 10 和 Windows Server 2016 之前，通常可以在不提升权限的情况下远程枚举某些 SAM 信息。

### 枚举远程计算机的本地组

使用 PowerView：

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

此命令尝试检索以下位置中的本地组： `WS02`.

### 无需 PowerView 的替代方法

使用 PowerShell 远程处理：

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

此命令会直接执行 `Get-LocalGroupMember` 在 `WS02`.

通常需要满足以下条件：

* 已启用 PowerShell 远程处理；
* 用户拥有必要的权限；
* 网络和防火墙规则允许该操作。

### 查看连接到远程计算机的用户

使用 PowerView：

```powershell
Get-NetLoggedon
```

此命令可识别当前在某台机器上已通过身份验证的用户。

了解以下信息很有用：

* 用户登录到了哪里；
* 某台机器上是否有管理员处于活动状态；
* 哪些机器可能值得进一步分析。

### 查看已打开到你机器的会话

使用 PowerView：

```powershell
Get-NetSession
```

此命令显示已建立到该机器的 SMB 会话。

例如，如果某个用户尝试访问：

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

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-315e3fccee4b5d1998a8a148bd42f34ee5b31c8a%2Fimage%20(3196).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/zh/active-directory/enumeration/remote-sam-enumeration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
