PowerShell DirectorySearcher AD Computer Enumeration via System.DirectoryServices.DirectorySearcher

Flags PowerShell DirectorySearcher queries that load directory properties and enumerate results from Active Directory.

FreeReviewedSigma · Medium · v2
Product
windows
Category
ps_script
Author
frack113 (SigmaHQ), DRL 1.1
Published
2022-02-12
Updated
2026-07-31
title: PowerShell DirectorySearcher AD Computer Enumeration via System.DirectoryServices.DirectorySearcher
id: 9db693a2-8bc9-4cb9-b3a4-1e7dc31fff86
status: test
description: This rule identifies PowerShell script content that constructs a System.DirectoryServices.DirectorySearcher, loads directory searcher properties, and invokes findall to enumerate results. Attackers often use directory querying to discover domain-joined computers before further exploitation or lateral movement. It relies on Script Block Logging telemetry capturing the PowerShell script text containing the specified DirectorySearcher and query method patterns.
references:
  - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1018/T1018.md#atomic-test-15---enumerate-domain-computers-within-active-directory-using-directorysearcher
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_directorysearcher.yml
author: frack113, Huntrule Team
date: 2022-02-12
tags:
  - attack.discovery
  - attack.t1018
logsource:
  product: windows
  category: ps_script
  definition: "Requirements: Script Block Logging must be enabled"
detection:
  selection:
    ScriptBlockText|contains|all:
      - "New-Object "
      - System.DirectoryServices.DirectorySearcher
      - .PropertiesToLoad.Add
      - .findall()
      - Properties.name
  condition: selection
falsepositives:
  - Unknown
level: medium
license: DRL-1.1
related:
  - id: 1f6399cf-2c80-4924-ace1-6fcff3393480
    type: derived