Skip to content

Commit 226adc3

Browse files
authored
Update active-directory.md
1 parent dee02a0 commit 226adc3

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed

windows-1/active-directory.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,121 @@
11
# Active Directory
22

3+
## Get Domain Information
4+
5+
```
6+
nltest /DCLIST:DomainName
7+
nltest /DCNAME:DomainName
8+
nltest /DSGETDC:DomainName
9+
```
10+
11+
### Get Current Domain Info - Similar to Get-Domain
12+
13+
```powershell
14+
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
15+
```
16+
17+
### View Domain Forest Info
18+
19+
```powershell
20+
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
21+
```
22+
### View Domain Trust Information
23+
24+
#### Using PowerShell
25+
26+
```powershell
27+
([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).GetAllTrustRelationships()
28+
29+
([System.DirectoryServices.ActiveDirectory.Forest]::GetForest((New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext('Forest', 'forest-of-interest.local')))).GetAllTrustRelationships()
30+
```
31+
32+
#### Using CMD.exe
33+
34+
```
35+
nltest /domain_trusts
36+
37+
nltest [server:<fqdn_foreign_domain>] /domain_trusts /all_trusts /v
38+
39+
nltest /dsgetfti:<domain>
40+
41+
nltest /server:<ip_dc> /domain_trusts /all_trusts
42+
```
43+
44+
### View All Domain Controllers
45+
46+
```
47+
nltest /dclist:$domainFQDN
48+
net group "domain controllers" /domain
49+
```
50+
51+
### View DC for Current Session
52+
53+
```
54+
nltest /dsgetdc:$domainFQDN
55+
```
56+
57+
## Kerberos
58+
59+
### get domain name and DC the user authenticated to
60+
61+
```
62+
klist
63+
```
64+
65+
### Get All Logged on Sessions, Includes NTLM & Kerberos
66+
67+
```
68+
klist sessions
69+
```
70+
71+
### View Current Kerberos Tickets
72+
73+
```
74+
klist
75+
```
76+
77+
### View Cached Krbtgt
78+
79+
```
80+
klist tgt
81+
```
82+
83+
## User Enumeration
84+
85+
### Get User-related Environment Variables (cmd.exe)
86+
87+
```
88+
set u
89+
```
90+
91+
### List all Usernames
92+
93+
```powershell
94+
([adsisearcher]"(&(objectClass=User)(samaccountname=*))").FindAll().Properties.samaccountname
95+
```
96+
97+
### List Administrators
98+
99+
```powershell
100+
([adsisearcher]"(&(objectClass=User)(admincount=1))").FindAll().Properties.samaccountname
101+
```
102+
103+
### List all Info about Specific User
104+
105+
#### Using PowerShell
106+
107+
```powershell
108+
([adsisearcher]"(&(objectClass=User)(samaccountname=<username>))").FindAll().Properties
109+
```
110+
111+
#### Using CMD.exe
112+
113+
```
114+
nltest /user:"zweilos"
115+
```
116+
117+
### View All Users with Description Field Set
118+
119+
```powershell
120+
([adsisearcher]"(&(objectClass=group)(samaccountname=*))").FindAll().Properties | % { Write-Host $_.samaccountname : $_.description }
121+
```

0 commit comments

Comments
 (0)