PowerShell AD Account Creation Library Usage via AccountManagement Namespace on Windows

Alert on PowerShell Script Block content referencing System.DirectoryServices.AccountManagement, indicating potential AD principal manipulation.

FreeReviewedSigma · Medium · v2
Product
windows
Category
ps_script
Author
frack113 (SigmaHQ), DRL 1.1
Published
2021-12-28
Updated
2026-07-31
title: PowerShell AD Account Creation Library Usage via AccountManagement Namespace on Windows
id: a0883874-d728-4671-967e-78bef6859842
status: test
description: This rule flags PowerShell scripts that reference the System.DirectoryServices.AccountManagement namespace, which is commonly used to create or manage Active Directory accounts and related security principals. Attackers may use this capability to establish domain accounts for persistence and access across systems within an AD domain. The detection relies on PowerShell Script Block Logging telemetry capturing the script contents.
references:
  - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1136.002/T1136.002.md#atomic-test-3---create-a-new-domain-account-using-powershell
  - https://learn.microsoft.com/en-us/dotnet/api/system.directoryservices.accountmanagement?view=net-8.0
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_directoryservices_accountmanagement.yml
author: frack113, Huntrule Team
date: 2021-12-28
tags:
  - attack.persistence
  - attack.t1136.002
logsource:
  product: windows
  category: ps_script
  definition: "Requirements: Script Block Logging must be enabled"
detection:
  selection:
    ScriptBlockText|contains: System.DirectoryServices.AccountManagement
  condition: selection
falsepositives:
  - Legitimate administrative script
level: medium
license: DRL-1.1
related:
  - id: b29a93fb-087c-4b5b-a84d-ee3309e69d08
    type: derived