1. Resources
  2. Detection sources
  3. Event ID 5141

Event ID 5141: A directory service object was deleted

Written by a domain controller when an Active Directory object whose SACL audits deletion is deleted. Used to catch deleted Group Policy objects, removed domain controller registrations and DNS names that live only briefly.

Log source
Windows Security log
Detection value
High
Volume
Medium (estimate)
Last updated
Audit subcategory
Audit Directory Service Changes (DS Access, Success)
Logged on
Domain controllers only
Event versions
0
Detects
3 attacks (2 rules · 2 detection logic)
MITRE ATT&CK
3 techniques in 4 tactics
Threat groups
7 groups that MITRE ATT&CK records using these techniques
Fields the rules read
ObjectClass

When it is written

A domain controller writes 5141 when an object is deleted and the deleted object itself has an auditing entry for the Delete action (Microsoft's event page). Microsoft's AD DS auditing guide, written for Windows Server 2008, lists two more entries that trigger the event: Delete child objects on the parent of the deleted object, and Delete subtree on the root of a subtree deletion. The event page says the event is generated only with the first, so put Delete on the objects themselves and do not count on the other two alone. Only successful deletions are logged, by the domain controller that performed them.

Tree Delete (TreeDelete) says whether the deletion used the Delete Subtree server control, which removes a container together with everything under it. Microsoft's guide adds that an object removed as part of such a deletion is audited only if it carries a Delete entry of its own: the entry on the root does not cover the objects under it, so one event with Tree Delete set to Yes can stand for many deleted objects. A deleted object moves to the Deleted Objects container: Microsoft notes that Event Viewer then resolves the event's GUID to that new location, and while the object is kept there it can be restored, which is logged as 5138 when the container it is restored to audits Create.

How to turn it on

Advanced audit policy subcategory Audit Directory Service Changes, Success. Set it in a Group Policy object linked to the computers that write the event:

Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy Configuration > Audit Policies > DS Access > Audit Directory Service Changes
Microsoft's recommendation per computer role
ComputerAuditNote
Domain controllersSuccessMicrosoft recommends Success auditing in both its general and stronger baselines, with SACLs designed for the important objects, classes and operations (it names changes to AdminSDHolder and the Domain Admins group). The subcategory has no failure events; failed access attempts are logged by Audit Directory Service Access.
Member serversNot loggedMicrosoft says the subcategory makes sense only on domain controllers.
WorkstationsNot loggedMicrosoft says the subcategory makes sense only on domain controllers.
Check the current setting
auditpol /get /subcategory:"Directory Service Changes"
Based on vendor documentation.
Turn it on (local policy; a domain GPO overrides it)
auditpol /set /subcategory:"Directory Service Changes" /success:enable
Based on vendor documentation.
The same on a Windows in another display language
auditpol /get /subcategory:"{0CCE923C-69AE-11D9-BED3-505054503030}"
Based on vendor documentation.

Run the commands in an elevated prompt on a computer that writes the event. Subcategory settings take effect only when the security option Audit: Force audit policy subcategory settings (Windows Vista or later) to override audit policy category settings is enabled (the default), and a Group Policy object that sets advanced audit policy replaces local changes at its next refresh. Microsoft's advanced audit policy reference

Microsoft's event page states that 5141 is generated only if the deleted object has an auditing entry for the Delete action, so the entry should reach the objects themselves, not only their container. Microsoft's AD DS auditing guide also lists Delete child objects on the parent and Delete subtree on the root of a subtree deletion as triggers; the entries below work under both readings. Audit Directory Service Changes (Success) must be on for every domain controller. For the rules on this page:

  • Group Policy objects: on CN=Policies,CN=System, Delete and Delete subtree for descendant groupPolicyContainer objects.
  • Domain controller registrations: on CN=Sites in the Configuration partition, Delete for descendant nTDSDSA objects.
  • DNS names: on each AD-integrated zone you watch, Delete for descendant dnsNode objects.

The default SACL of the domain object (the Windows Server 2003 and later default in Microsoft's schema reference) does not audit deletion. Microsoft's Defender for Identity setup does: its entries for descendant user, group, computer and managed service account objects select Full control minus the read permissions, which includes Delete and Delete subtree, so deletions of those accounts are logged in a domain configured that way. With the object types Microsoft lists, it puts no Delete entry on Group Policy objects, domain controller registrations or DNS names.

Fields

In Event Viewer order. The field names are those of the event XML, from the event template that ships with Windows.

FieldWhat it holdsSince
Security IDSubjectUserSidSubjectSID of the account that deleted the object. Event Viewer resolves it to a name.v0
Account NameSubjectUserNameSubjectName of the account that deleted the object. Computer accounts end with $.v0
Account DomainSubjectDomainNameSubjectDomain of the account that deleted the object, usually as a NetBIOS name.v0
Logon IDSubjectLogonIdSubjectLogon ID of the session that deleted the object, in hexadecimal. Matches the 4624 event of that session on this domain controller.v0
NameDSNameDirectory ServiceName of the Active Directory domain in which the object was deleted, as a DNS name.v0
TypeDSTypeDirectory ServiceDirectory service type. %%14676 (Active Directory Domain Services) on domain controllers.v0
DNObjectDNObjectDistinguished name the object had before it was deleted.v0
GUIDObjectGUIDObjectobjectGUID of the deleted object, in braces. Event Viewer resolves it to the object's new place in Deleted Objects; use it to find the 5137 that created the object or the 5138 that restores it.v0
ClassObjectClassObjectRead by 2 rulesClass of the deleted object, for example groupPolicyContainer, nTDSDSA, dnsNode, user or computer.v0
Tree DeleteTreeDeleteOperationWhether the Delete Subtree server control was used, as %%14678 (Yes) or %%14679 (No).v0
Correlation IDOpCorrelationIDOperationCorrelation ID shared by every event of the same LDAP operation, in braces.v0
Application Correlation IDAppCorrelationIDOperationApplication Correlation ID. Microsoft says it is not in use and always holds a dash.v0

Values to know

Class ObjectClass

ValueMeaningSignal
groupPolicyContainerA Group Policy object was deletedThe settings the GPO applied stop being applied. Microsoft recommends monitoring GPO deletions.Attack signal
nTDSDSAThe NTDS Settings object of a domain controller was deletedExpected when a domain controller is demoted or its metadata is cleaned up. A deletion minutes after the 5137 that created it is what a temporary rogue domain controller (DCShadow) leaves.Attack signal
dnsNodeA name was removed from an AD-integrated DNS zoneUsually clean-up. Paired with a recent 5137 of the same object by a user account it is a short-lived name, which a hypothesis follows.Worth knowing
user, computer or groupAn account or a group was deletedAlso logged as 4726, 4743 and the group deletion events without a SACL. Watch deletions of critical accounts, as Microsoft suggests.Worth knowing

Tree Delete TreeDelete

ValueMeaningSignal
%%14678Yes: the Delete Subtree server control was usedThe container and everything under it are deleted in one operation.Worth knowing
%%14679No: an ordinary deletionExpected

Volume and noise

Lower than for changes: deletions are less frequent than attribute writes. The sources are account and computer clean-up, removal of stale DNS names in audited zones, and Group Policy housekeeping. Volume follows the Delete entries in your SACLs.

Keeping it manageable

  • Keep every deletion of a groupPolicyContainer or an nTDSDSA object: both are rare and both feed rules.
  • Audit Delete only on the objects that matter: GPOs, domain controller registrations, Tier 0 accounts and groups, and the DNS zones you watch for names that are created and removed again.
  • Look at every event with TreeDelete set to Yes: Microsoft notes that a subtree deletion removes every object in the subtree, including objects protected from deletion, and the objects under the root get events of their own only where they carry a Delete entry themselves.
  • For DNS names, keep the deletions made by accounts that are not computer accounts: the hypothesis that follows short-lived names pairs a 5137 by a user account with a 5141 of the same object.

Sample event

Version 0, with made-up values.

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-Windows-Security-Auditing" Guid="{54849625-5478-4994-a5ba-3e3b0328c30d}" />
    <EventID>5141</EventID>
    <Version>0</Version>
    <Level>0</Level>
    <Task>14081</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8020000000000000</Keywords>
    <TimeCreated SystemTime="2026-11-18T09:30:12.4567890Z" />
    <EventRecordID>1048576</EventRecordID>
    <Correlation />
    <Execution ProcessID="712" ThreadID="2408" />
    <Channel>Security</Channel>
    <Computer>DC01.corp.example.com</Computer>
    <Security />
  </System>
  <EventData>
    <Data Name="OpCorrelationID">{f0b3d2a7-8e14-4c69-b1a5-73d9e2c4f816}</Data>
    <Data Name="AppCorrelationID">-</Data>
    <Data Name="SubjectUserSid">S-1-5-21-1004336348-1177238915-682003330-1105</Data>
    <Data Name="SubjectUserName">alice</Data>
    <Data Name="SubjectDomainName">CORP</Data>
    <Data Name="SubjectLogonId">0x3e5a21</Data>
    <Data Name="DSName">corp.example.com</Data>
    <Data Name="DSType">%%14676</Data>
    <Data Name="ObjectDN">CN=WS0099,OU=Workstations,DC=corp,DC=example,DC=com</Data>
    <Data Name="ObjectGUID">{4b7e1d93-a2c5-4f80-9d36-e15b0c7a2f49}</Data>
    <Data Name="ObjectClass">computer</Data>
    <Data Name="TreeDelete">%%14679</Data>
  </EventData>
</Event>

Attacks this event reveals

Detection rules that read this event:

Detection logic (hypotheses that join this event with others) for:

Frequently asked questions

Does the auditing entry for 5141 go on the deleted object or on its container?

On the object. Microsoft's event page states that the event is generated only if the deleted object has an auditing entry for the Delete action. Put the entry on the container with inheritance to the descendant objects of the class you watch, so that every object carries it. Microsoft's AD DS auditing guide for Windows Server 2008 also lists Delete child objects on the parent as a trigger, but the event page does not, so do not rely on that entry alone.

What does Tree Delete mean?

Yes means the Delete Subtree server control was used, for example by selecting Use Delete Subtree server control in Active Directory Users and Computers. The container is deleted with every object under it, including objects protected from accidental deletion. The objects under it get 5141 events of their own only where they carry a Delete entry themselves.

Can a deleted object come back?

Yes, while it is kept in the Deleted Objects container. A restore is logged as 5138 with the same ObjectGUID, provided the container the object is restored to audits Create.

References