> 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 表示 **安全账户管理器**.

它包含有关以下内容的信息：

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

在较旧版本的 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="/files/84e2dbb613ebee4481d624452e4bcbaf9d433bee" 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/zh/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.
