When it is written
A domain controller writes 4766 when an attempt to add SID History to an account fails; the successful counterpart is 4765. It is an Audit Failure event, so it needs Failure auditing on Audit User Account Management, which Microsoft recommends on domain controllers for exactly this event among others.
Microsoft's migration function, DsAddSidHistory, writes an "Add SID History" audit event in the destination domain for each failed operation as well as for each success. The function refuses, among other cases, a source SID that already exists in the destination forest, mismatched object types (a user to a group), computer, trust and well-known accounts, a well-known RID such as Administrator or Domain Admins copied to an account without the same RID, and a caller who is not in Domain Admins of the destination domain. The event does not say which of these caused the failure.
The template differs from 4765: it has no SID for the subject (Event Viewer shows an empty Security ID) and no SID for the source account, and Windows stores the target SID and the Logon ID as text. Microsoft's event page has no sample event.
How to turn it on
Advanced audit policy subcategory Audit User Account Management, Failure. 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 > Account Management > Audit User Account Management| Computer | Audit | Note |
|---|---|---|
| Domain controllers | Success and Failure | Microsoft's general and stronger baselines both recommend Success and Failure auditing. Microsoft calls the subcategory useful for watching critical domain accounts (domain admins, service accounts, database admins) and recommends Failure auditing mainly for invalid password change and reset attempts on domain accounts, failed changes of the DSRM password and failed SID History additions. |
| Member servers | Success and Failure | Both baselines recommend Success and Failure auditing. Microsoft recommends watching every change to local user accounts, especially the built-in local Administrator and other critical accounts, and Failure auditing mainly for invalid password change and reset attempts on local accounts. |
| Workstations | Success and Failure | Both baselines recommend Success and Failure auditing. Microsoft recommends watching every change to local user accounts, especially the built-in local Administrator and other critical accounts, and Failure auditing mainly for invalid password change and reset attempts on local accounts. |
auditpol /get /subcategory:"User Account Management"auditpol /set /subcategory:"User Account Management" /failure:enableauditpol /get /subcategory:"{0CCE9235-69AE-11D9-BED3-505054503030}"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
Fields
In Event Viewer order. The field names are those of the event XML, from the event template that ships with Windows.
| Field | What it holds | Since |
|---|---|---|
Account NameSubjectUserNameSubject | Name of the account that made the attempt. The event has no SID for the subject: Event Viewer shows the Security ID line empty. | v0 |
Account DomainSubjectDomainNameSubject | Domain of that account. | v0 |
Logon IDSubjectLogonIdSubject | Logon ID of the session that made the attempt, in hexadecimal, stored as text in this event. The logon event of that session (4624) on the same domain controller carries the same value. | v0 |
Security IDTargetSidTarget Account | SID of the account that was to receive SID History. Stored as text in this event's template, so Event Viewer shows it as written. | v0 |
Account NameTargetUserNameTarget Account | Name of the account that was to receive SID History. | v0 |
Account DomainTargetDomainNameTarget Account | Domain of that account, as a NetBIOS or DNS name. | v0 |
Account NameSourceUserNameSource Account | Name of the account in the source domain whose SID was to be copied (shown as Account Name under Source Account). The event has no SID for it. | v0 |
PrivilegesPrivilegeListAdditional Information | Privileges used for the operation, such as SeBackupPrivilege. Often a dash. | v0 |
Values to know
Account Name SourceUserName
| Value | Meaning | Signal |
|---|---|---|
An ordinary account of the source domain, during a planned migration | A migration step that failedCheck the migration log for the reason. | Failure |
Administrator, Domain Admins or another privileged account | Attempt to copy a privileged SIDThe migration function refuses well-known accounts and well-known RIDs copied to an account without the same RID, so such an attempt fails. The attempt itself is the finding. | Attack signal |
Account Name SubjectUserName
| Value | Meaning | Signal |
|---|---|---|
The migration account, during a change window | Planned migration | Expected |
Any other account | SID History attempted outside a planned migrationThe SID History rule alerts on every 4765 and 4766. | Attack signal |
Volume and noise
None in normal operation. During a planned migration a few failures can appear for accounts the migration function refuses, with the migration account as Subject.
Keeping it manageable
- Collect 4766 from every domain controller, which needs Failure auditing on Audit User Account Management, and keep every event: the SID History rule alerts on each one.
- During a planned migration, review failures for the migration account against the migration plan rather than suppressing them: a failure for a privileged source account is worth a look even then.
- Because the subject has no SID in this event, match the actor by
SubjectUserNameandSubjectDomainName, and joinSubjectLogonIdwith the logon event (4624) of the same domain controller.
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>4766</EventID>
<Version>0</Version>
<Level>0</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8010000000000000</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="SourceUserName">bob</Data>
<Data Name="TargetUserName">bob</Data>
<Data Name="TargetDomainName">CORP</Data>
<Data Name="TargetSid">S-1-5-21-1004336348-1177238915-682003330-1121</Data>
<Data Name="SubjectUserName">svc-migration</Data>
<Data Name="SubjectDomainName">CORP</Data>
<Data Name="SubjectLogonId">0x5b2c11</Data>
<Data Name="PrivilegeList">-</Data>
</EventData>
</Event>Attacks this event reveals
Detection rules that read this event:
Frequently asked questions
Why would adding SID History fail?
Microsoft lists the cases the migration function refuses: a source SID that already exists in the destination forest, object types that do not match, computer, trust and well-known accounts, a well-known RID such as Administrator or Domain Admins copied to an account without the same RID, a source and destination in the same forest, and a caller outside Domain Admins of the destination domain. The event does not record the reason.
Why does 4766 have no subject SID?
The event's template has no SID field for the subject, so Event Viewer shows the Security ID line empty. Use `SubjectUserName`, `SubjectDomainName` and `SubjectLogonId`, and find the session's logon event (4624) on the same domain controller.
Is a failed attempt worth an alert?
Yes. Outside a planned migration nobody has a reason to add SID History, and a failure can mean the attempt targeted a SID that the migration function refuses, privileged ones among them. The library's SID History rule treats 4766 like 4765.