# Enumerate Domain Trusts

This snippet enumerates standard information about domain trusts.

```powershell
# import PowerView
Import-Module ..\PowerView.ps1

# enumerate all domain trusts with the default LDAP method 
Get-DomainTrust

# enumerate all domain trusts w/ .NET methods
Get-DomainTrust -NET

# enumerate all domain trusts w/ API methods
Get-DomainTrust -API

# enumerate forest trusts
Get-ForestTrust

# enumerate trusts for domain.com
Get-DomainTrust -Domain domain.com

Get-DomainForeignUser
Get-DomainForeignGroupMember -Domain domain.com

Get-DomainForeignGroupMember -Domain anotherdomain.com | %{ $_ | Add-Member Noteproperty 'ResolvedSID' $(ConvertFrom-SID $_.MemberName); $_}
```

Reference:

* [Domain Trusts](https://otter.gitbook.io/red-teaming/notes/interfacing-with-ad#domain-trusts)


---

# 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://otter.gitbook.io/red-teaming/notes/powershell/powershell-snippets/enumerate-domain-trusts.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.
