> 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/local-machine-enumeration.md).

# 本地机器枚举

### 基本用户和机器信息

显示当前用户名：

```powershell
$env:Username
```

显示用户域：

```powershell
$env:UserDomain
```

显示机器名：

```powershell
$env:ComputerName
```

这些命令可快速识别：

* 我们正在使用哪个用户；
* 我们所在的是哪台机器；
* 你连接到哪个域或工作组。

### 本地组枚举

使用 PowerView：

```powershell
Get-NetLocalGroup
```

使用原生 PowerShell：

```powershell
Get-LocalGroup
```

这些命令会显示机器的本地组，例如：

* `Administrators`
* `Users`
* `远程桌面用户`
* `来宾`

### 查看 Administrators 组的成员

使用 PowerView：

```powershell
Get-NetLocalGroupMember -Groupname Administrators | Select-Object MemberName, IsGroup, IsDomain
```

使用原生 PowerShell：

```powershell
Get-LocalGroupMember -Group Administrators
```

此步骤对于识别以下内容很重要：

* 本地管理员；
* 本地添加的域组；
* 在该机器上具有提升权限的用户。

### 查看用户所属的组

使用 PowerView：

```powershell
Get-NetGroup -UserName "user1" | select name
```

这使你能够知道某个特定用户属于哪些组。

有趣的示例：

* 检查是否 `user1` 属于特权组；
* 识别诸如以下这类值得关注的组： `Administrators`, `RDPUsers`, `高管`，等等。


---

# 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/local-machine-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.
