# Forest Mappings

## Get Details about the Current Forest

```powershell
# AD Module
Get-ADForest
Get-ADForest -Identity lab.local

# PowerView
Get-NetForest
Get-NetForest -Forest lab.local
```

## Get All Domains in the Current Forest

```powershell
# AD Module
(Get-ADForest).Domains

# PowerView
Get-NetForestDomain
Get-NetForestDomain -Forest lab.local
```

## Get All Global Catalogs for the Current Forest

```powershell
# AD Module
Get-ADForest | Select -ExpandProperty GlobalCatalogs

# PowerView
Get-NetForestCatalog
Get-NetForestCatalog -Forest lab.local
```

## Map Trusts of a Forest

```powershell
# AD Module
Get-ADTrust -Filter 'msDS-TrustForestTrustInfo -ne "$null"'

# PowerView
Get-NetForestTrust
Get-NetForestTrust -Forest lab.local
```

## Map All Trusts in Current Forest

```powershell
# PowerView
Get-NetForestDomain |  Get-NetDomainTrust
```


---

# Agent Instructions: 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:

```
GET https://wiki.bufu-sec.com/active-directory/enumeration/forest_mappings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
