Skip to content
WETNav
SecurityDS Access

Event ID 5138: A directory service object was undeleted

A directory service object was undeleted.

Channel
Security
Logged by default
No
Written on
Any host
Volume
Moderate
Audit subcategory
Directory Service Changes
Needs a SACL
Yes

To have this event

  • Enable Directory Service Changes: auditpol /set /subcategory:"Directory Service Changes" /success:enable /failure:enable

Pull this event

Retrieval queries for a live host, a collected .evtx file and common SIEMs. Filter further on the key fields above.

Get-WinEvent -LogName 'Security' -FilterXPath "*[System[(EventID=5138)]]" -MaxEvents 50 |
  Select-Object TimeCreated, Id, MachineName, Message

-FilterXPath supports exact matches only. For substring matching, filter in Where-Object.

Common questions

What does Windows event ID 5138 mean?
A directory service object was undeleted. It is written to the Windows Security log (Security).
Is event 5138 logged by default?
No. It must be enabled before it is recorded. It is controlled by the "Directory Service Changes" Advanced Audit Policy subcategory (DS Access). It also requires a SACL on the audited object.

A directory service object was undeleted. Needs the "Directory Service Changes" audit subcategory. Key fields, logging requirements, ATT&CK mapping and ready-to-run queries.