Manual Information Gathering

User information (cmd)

net user /domain # list all domain users
net user <USER> /domain # get information about a specific user in the domain
net group /domain # list all groups in the domain
net group <GROUP> /domain # get information about a specific group in the domain
net accounts # obtain account policy
Custom PowerShell scripts

You can write your own powershell scripts using LDAP to query the Active Directory.

Sample script to obtain the full LDAP path required for enumeration::

# Connection
$PDC = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().PdcRoleOwner.Name
$DN = ([adsi]'').distinguishedName 
$LDAP = "LDAP://$PDC/$DN"
$LDAP # Print LDAP Path

# Get Objects
$direntry = New-Object System.DirectoryServices.DirectoryEntry($LDAP)

$dirsearcher = New-Object System.DirectoryServices.DirectorySearcher($direntry)
$dirsearcher.FindAll()

User / Object information

Most enumeration in this chapter require powerview module.

See more PowerView commands: https://book.hacktricks.xyz/windows-hardening/basic-powershell-for-pentesters/powerview

Import PowerView:

powershell -ep bypass
Import-Module .\PowerView.ps1

Basic Info

Operating systems information

OS, User combination

In some cases you can enumerate users which are logged in on other hosts.

Service Accounts

Programs that are run by system are launched in the context of Service Account.

(LocalSystem, LocalService, and NetworkService)

Applications such as Exchange, MS SQL, or IIS use SPN (Service Principial Name) to link it to the specific Service Account in AD.

List the SPN in the domain:

Object Permissions enumeration

In AD there are ACE (Access Control Entries) which are included in ACL (Access Control List).

Key AD Permissions:

ACE enumeration with PowerView:

We can convert SID which we got to readable data:

Search for GenericAll Permission:

Domain shares enumeration

Find domain shares with PowerView:

Interesting shares:

Last updated