# Domain Trusts and Forests Enumeration

## Trusts

### Get a List of All Trusts in the Current Domain

```powershell
Get-NetDomainTrust [-Domain <domain>] # PowerView
Get-ADTrust -Filter * [-Identity <domain>] # AD Module
```

* Using pywerview\.py

```bash
python pywerview.py get-netdomaintrust -w bizcorp.local -u <user> -p <pass> -t <dc> [-d <domain>] 
```

### Listing All Trusts in Another Forest (If Your Current Forest is in a Bi-Directional Trust With Another Forest)

```powershell
Get-NetForestDomain -Forest <forest> | Get-NetDomainTrust # PowerView
```

## Forest Mapping

### Get Details About the Current Forest

```powershell
Get-NetForest [-Forest <forest>] # PowerView
Get-ADForest [-Identity <forest>] # AD Module
```

### Get All Domains in the Current Forest

```powershell
Get-NetForestDomain [-Forest <forest>] # PowerView
(Get-ADForest).Domains # AD Module
```

### Get All Global Catalogs for the Current Forest

```powershell
Get-NetForestCatalog [-Forest <forest>] # PowerView
Get-ADForest | select -ExpandProperty GlobalCatalogs # AD Module
```

### Map Trusts of a Forest

```powershell
Get-NetForestTrust [-Forest <forest>] # PowerView
Get-ADTrust -Filter 'msDS-TrustForestTrustInfo -ne "$null"' # AD Module
```


---

# 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://csforza.gitbook.io/pentesting-articles-and-notes/windows/active-directory/enumeration/domain-trusts-and-forests-enumeration.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.
