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

# Active Directory PowerShell 模块

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

### 目标

Active Directory 模块可让你使用如下命令：

{% code overflow="wrap" %}

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

{% endcode %}

在域控制器上，该模块通常默认可用。

在普通的 Windows 10 机器上，它通常未安装。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e835a3ce5c62ea2994d99d4e14d71d87c29254d2%2Fimage%20(3200).png?alt=media" alt=""><figcaption></figcaption></figure>

### 加载域信息

在域控制器上：

```bash
Get-ADDomain
```

此命令返回以下重要信息：

* 域名；
* 域的 SID；
* 域的功能模式；
* 林；
* 主域控制器；
* 基础结构主机；
* AD 配置信息。

### 在没有 RSAT 的机器上使用该模块

可以从 DC 获取该 DLL：

{% 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 %}

然后我们将其复制到 `WS02`，然后导入它：

{% code overflow="wrap" %}

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

{% endcode %}

然后我们可以测试：

{% code overflow="wrap" %}

```powershell
Get-ADDomain
```

{% endcode %}

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-df6f8940343be30bf005b7e63a7dd5947696fb56%2Fimage%20(3201).png?alt=media" alt=""><figcaption></figcaption></figure>

### 使用 PowerView 的替代方法

在没有 Active Directory 模块的情况下，PowerView 提供等效命令。

获取域信息：

{% code overflow="wrap" %}

```powershell
Get-NetDomain
```

{% endcode %}

获取域策略：

{% code overflow="wrap" %}

```powershell
Get-DomainPolicy
```

{% endcode %}

显示 `SystemAccess` 部分：

{% code overflow="wrap" %}

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

{% endcode %}

这使你能够获取如下信息：

* 密码策略；
* 账户锁定；
* 密码的最大期限；
* 域安全设置。


---

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