If you've ever cloned a Windows virtual machine or used a disk image to spin up multiple machines quickly, you've probably run into some baffling authentication failures. Users can't log in, services refuse to start, and your event logs are full of Kerberos and NTLM errors that seem to point in every direction at once. Nine times out of ten, the root cause is the same: duplicate Security Identifiers, or SIDs. In this guide, I'll walk you through exactly what duplicate SIDs are, why they break authentication, and, most importantly, how to fix them step by step.

What Are SIDs and Why Do They Matter?

Every Windows machine, user account, and security group gets assigned a unique Security Identifier when it's created. A SID looks something like this: S-1-5-21-3623811015-3361044348-30300820-1013. That long string is how Windows internally identifies everything, not by name, but by this unique number. When your machine wants to authenticate a user or authorize access to a resource, it checks SIDs, not usernames.

When you clone a virtual machine or deploy from a template without properly running Sysprep, the cloned machine carries the same SID as the original. You now have two, or potentially dozens, of machines with identical SIDs on the same network. From Windows' perspective, these machines are the same machine. The result is authentication chaos.

Both Kerberos and NTLM rely on SIDs during the authentication process. Kerberos tickets contain SID information for authorization, and NTLM uses SIDs to build access tokens. When multiple machines share a SID, the domain controllers and the machines themselves get confused about identity, trust, and authorization, and authentication starts failing in ways that are incredibly hard to diagnose without knowing the root cause.

How Duplicate SIDs Break Kerberos and NTLM Authentication

Let me explain the mechanics so you understand exactly what's happening under the hood, this will help you diagnose the problem much faster when you see it in the wild.

Kerberos Authentication Failures

Kerberos is the primary authentication protocol in Active Directory environments. It works on the basis of tickets issued by a Key Distribution Center (KDC), which is your domain controller. When a user on Machine A tries to access a resource on Machine B, the KDC issues a service ticket. That ticket includes the SID of the requesting user and machine.

When Machine A and Machine C share the same machine SID, the KDC can get confused about which machine is actually making the request. More critically, if those machines are joined to the domain and their computer accounts have overlapping SID-related attributes, the ticket validation process fails. You'll see events like Event ID 4 (Kerberos) in the system log, or the dreaded KDC_ERR_C_PRINCIPAL_UNKNOWN error. Services that use Kerberos for mutual authentication, like SQL Server, IIS with Windows Authentication, or SharePoint, will simply refuse connections.

NTLM Authentication Failures

NTLM is the fallback protocol and is also used in workgroup environments, older applications, and certain cross-forest scenarios. NTLM uses the machine's SID as part of building the NTLM security blob during the challenge-response handshake. When the SID is duplicated, resource servers may cache access tokens tied to the SID and then incorrectly apply them to the wrong machine. You'll see Event ID 4625 (failed logon) with logon type 3 (network logon), often accompanied by error code 0xC000006D (wrong username or authentication information) or 0xC0000064 (user name doesn't exist).

The Domain Trust Angle

Domain trusts are also SID-based. If two machines in your environment share a SID, SID filtering, a security feature that protects against SID spoofing across trusts, may start blocking legitimate authentication requests. This makes cross-domain authentication fail even when credentials are perfectly valid. This is one of the nastier side effects, because it looks exactly like a trust or DNS problem rather than a SID issue.

Warning: Duplicate SIDs don't just cause authentication errors. They can also cause problems with Group Policy application, software licensing, RDS licensing, and Windows Update. If you're seeing unexplained failures in any of these areas alongside authentication errors, duplicate SIDs are high on the suspect list.

Diagnosing the Problem: Is It Actually a Duplicate SID?

Before you start making changes, confirm that duplicate SIDs are the actual problem. Here's how to check.

1
Check the Machine SID on Each Affected Machine

Open PowerShell as Administrator on the suspected machines and run the following command to retrieve the machine SID:

$sid = (Get-WmiObject Win32_ComputerSystem).Name
$objSID = New-Object System.Security.Principal.NTAccount($sid)
[System.Security.Principal.SecurityIdentifier]::new(
    [System.Security.Principal.WellKnownSidType]::LocalSystemSid, $null
)

A more reliable method is to use the PsGetSid tool from Sysinternals (part of the PsTools suite). Download it from the official Microsoft Sysinternals page and run:

psgetsid \\MachineName

Run this on each machine you suspect. If two or more machines return the same SID, you've found your culprit.

2
Check the Event Logs

On the affected machines and on your domain controller, open Event Viewer and check the following logs:

  • System log, Look for Kerberos errors (Source: Kerberos, Event IDs 4, 7, 14)
  • Security log, Look for Event ID 4625 (failed logons) and Event ID 4771 (Kerberos pre-authentication failed)
  • Directory Service log, On domain controllers, look for replication errors or authentication-related warnings

You can filter the Security log quickly with PowerShell:

Get-WinEvent -FilterHashtable @{
    LogName = 'Security'
    Id = 4625, 4771, 4776
    StartTime = (Get-Date).AddDays(-1)
} | Select-Object TimeCreated, Id, Message | Format-List
3
Use Netlogon Logging for NTLM

Enable Netlogon debug logging to capture detailed NTLM failure information. Run this on the machine experiencing the failures:

nltest /dbflag:0x2080ffff

Then try the failing authentication. Review the log at C:\Windows\debug\netlogon.log. Look for entries that mention SID conflicts or "duplicate SID" messages. Disable the logging after you're done:

nltest /dbflag:0x0
Tip: Microsoft's Sysinternals PsGetSid can query multiple machines remotely. If you have a large environment, run it against all machines in a subnet to quickly identify every machine with a duplicate SID before you start remediation.

Step-by-Step Fix: Resolving Duplicate SIDs

Now that you've confirmed duplicate SIDs are the problem, here's how to fix them. The approach depends on whether the affected machines are already domain-joined or still in a workgroup.

1
Run Sysprep on Cloned Machines (Preferred Method)

The cleanest way to resolve a duplicate SID situation is to run Sysprep on each cloned machine. Sysprep reseals the operating system, generates a new unique SID, and clears machine-specific identifiers. This is the method Microsoft officially recommends.

On the affected machine, open an elevated command prompt and run:

C:\Windows\System32\Sysprep\sysprep.exe /generalize /oobe /reboot

The /generalize switch removes all unique system information including the SID. The /oobe switch puts the machine into Out-of-Box Experience mode on restart, where it will generate a fresh SID. The /reboot switch restarts automatically.

Warning: Running Sysprep will remove the machine from the domain if it's currently joined. You'll need to rejoin each machine to the domain after Sysprep completes. Also, applications that are licensed per-machine (like some versions of Microsoft Office) may need to be reactivated. Plan for this downtime before proceeding.
2
Rejoin the Domain After Sysprep

After the machine restarts and you complete the OOBE setup, you'll need to rejoin it to the domain. Before doing so, remove the old stale computer account from Active Directory if it still exists with the same name:

  1. On a domain controller, open Active Directory Users and Computers
  2. Find the computer account for the affected machine
  3. Right-click and select Delete, then confirm
  4. On the newly Sysprep'd machine, go to Settings > System > About > Domain or Workgroup
  5. Click Change and rejoin the domain with appropriate credentials

Alternatively, use PowerShell to rejoin:

$credential = Get-Credential  # Enter domain admin credentials
Add-Computer -DomainName "yourdomain.com" -Credential $credential -Restart
3
Alternative: Use NewSID (Legacy Environments Only)

In older environments where running Sysprep isn't practical, for instance, machines with specialized software that can't survive a Sysprep cycle, you can use NewSID from Sysinternals to change the machine SID without a full Sysprep. However, I need to be upfront with you: Microsoft has stated that changing the machine SID post-deployment using third-party tools is not supported and NewSID has been retired from the Sysinternals suite. Microsoft's official position is that the machine SID is not used for anything that would cause problems in a domain environment (only local accounts use the machine SID as a base).

That said, if you're dealing with a workgroup environment or older Windows versions where authentication issues persist, some administrators still use this approach as a last resort. If you go this route, document it carefully and test thoroughly before rolling it out broadly.

4
Force Kerberos Ticket Purge After Remediation

After you've resolved the SID duplication, old Kerberos tickets may still be cached on client machines. These stale tickets can continue causing authentication failures even after the SID issue is fixed. Purge them with:

klist purge

Run this on affected client machines. For domain controllers, you may also want to restart the Kerberos Key Distribution Center service:

Restart-Service kdc
5
Clear the NTLM Authentication Cache

NTLM caches credentials and access tokens that may be stale after a SID change. Clear the cached credentials using Credential Manager:

cmdkey /list

This shows all cached credentials. Remove the ones associated with the affected machines:

cmdkey /delete:MachineName

You can also clear all Windows cached credentials via Control Panel > User Accounts > Credential Manager > Windows Credentials and remove entries tied to the affected machines.

6
Restart the Affected Services

After cleaning up SIDs and tickets, restart the key authentication-related services. On the domain controllers:

Restart-Service NTDS
Restart-Service KDC
Restart-Service Netlogon

On the affected member machines:

Restart-Service Netlogon
Restart-Service LanmanWorkstation
Restart-Service LanmanServer

In many cases, a full reboot of the affected machines and domain controllers is the cleanest way to ensure all stale state is cleared.

Advanced Troubleshooting: When the Basic Fix Doesn't Work

Sometimes you've run Sysprep, rejoined the domain, purged tickets, and authentication is still failing. Here's what to check next.

Check for SID History Conflicts

Active Directory stores a SID History attribute on user and computer accounts. This attribute is used during domain migrations to preserve access to old resources. If a cloned machine was once migrated or if SID history was somehow populated with conflicting SIDs, authentication can still fail after Sysprep. Check SID history with PowerShell:

Import-Module ActiveDirectory
Get-ADComputer -Identity "MachineName" -Properties SIDHistory | Select-Object Name, SID, SIDHistory

If you see unexpected entries in SIDHistory, work with your domain administrator to clean them up. Be cautious, removing SID history entries can break access to resources for migrated accounts.

Investigate DNS and SPNs

Kerberos authentication depends heavily on DNS. When machines are cloned, they sometimes end up with duplicate DNS registrations. Kerberos uses Service Principal Names (SPNs) to identify services, and duplicate SPNs are a very common cause of Kerberos failure even after SID issues are resolved.

Check for duplicate SPNs across your domain:

setspn -X -F

This scans the entire forest for duplicate SPNs. Any duplicates found must be resolved, typically by deleting the SPN from the old or incorrect computer account:

setspn -D "HTTP/OldMachineName.domain.com" OldMachineName

Verify DNS Records

Stale DNS records from the cloned machines can cause Kerberos to send tickets to the wrong machine. Check for duplicate A records in your DNS server for the affected machines:

nslookup MachineName.yourdomain.com

If you see multiple IP addresses returned for one machine name, clean up the stale DNS records through DNS Manager on your DNS server, or use:

dnscmd /recorddelete yourdomain.com MachineName A /f

Check the Secure Channel

After Sysprep and domain rejoin, verify the secure channel between the machine and the domain controller is healthy:

nltest /sc_verify:yourdomain.com

If the secure channel is broken, reset it:

nltest /sc_reset:yourdomain.com

Or with PowerShell:

Test-ComputerSecureChannel -Repair -Credential (Get-Credential)

Review Group Policy Application

Duplicate SIDs can corrupt the Group Policy cache. If authentication works but GPO isn't applying correctly after your fix, clear the GP cache:

rd /s /q "%windir%\system32\GroupPolicy"
rd /s /q "%windir%\system32\GroupPolicyUsers"
gpupdate /force
Warning: Deleting the Group Policy cache will remove locally cached policies. Make sure your machine has network access to the domain controller so it can re-download them, otherwise you may be left without essential security configurations applied.

Analyze Kerberos Tickets in Detail

If you need to dig deeper into what Kerberos is actually doing, use the klist command to inspect current tickets:

klist tickets

Look at the client principal names and the service names in the tickets. If you see tickets referencing unexpected machine names or SIDs, it confirms stale ticket caching is still the problem. Purge and re-authenticate.

For even deeper analysis, enable Kerberos operational logging:

wevtutil sl Microsoft-Windows-Kerberos/Operational /e:true

Then review the log in Event Viewer under Applications and Services Logs > Microsoft > Windows > Kerberos > Operational.

Prevention: How to Never Deal with This Again

Fixing duplicate SIDs is painful. Preventing them is easy if you build the right habits into your VM deployment process.

Always Run Sysprep Before Cloning

This is the number-one rule. Before you create a VM template, golden image, or any image you intend to clone, run Sysprep with the /generalize flag. This removes the SID from the template so that every machine deployed from it gets a fresh, unique SID on first boot.

sysprep.exe /generalize /oobe /shutdown

Using /shutdown instead of /reboot shuts the machine down after generalization, which is what you want for templates, you don't want the template to boot back up and generate a new SID for itself before you capture the image.

Use Unattend.xml for Automated Deployments

For large-scale deployments using WDS, MDT, or SCCM/Endpoint Configuration Manager, use an unattend.xml answer file that includes Sysprep settings. This ensures every deployed machine goes through the generalization process automatically and never ends up with a duplicate SID.

Validate Deployments with Automated SID Checks

Build a post-deployment validation script that checks for SID uniqueness across your environment. Run it as part of your deployment pipeline:

$computers = Get-ADComputer -Filter * -Properties SID
$sids = $computers | Group-Object -Property SID
$duplicates = $sids | Where-Object { $_.Count -gt 1 }
if ($duplicates) {
    Write-Warning "Duplicate SIDs found!"
    $duplicates | ForEach-Object {
        Write-Output "SID: $($_.Name)"
        $_.Group | ForEach-Object { Write-Output "  - $($_.Name)" }
    }
} else {
    Write-Output "All SIDs are unique. No issues detected."
}

Use Virtual Machine Templates Properly

If you're using VMware vSphere, Hyper-V, or a cloud platform like Azure or AWS, use the platform's native templating and customization features rather than simple disk cloning. vSphere's Guest Customization Specifications, for instance, run Sysprep automatically during deployment. Azure's VM generalization process (waagent -deprovision on Linux, Sysprep on Windows) does the same. Use these features, they exist exactly to solve this problem.

Document Your Clone Policy

Create a written policy for your team that explicitly states: no VM may be deployed from a clone or template unless it has been properly generalized. Make this part of your change management process. A policy that lives in documentation is far less painful than an incident that takes down authentication for your entire environment.

Frequently Asked Questions

Does having duplicate machine SIDs actually matter in a domain environment?
Microsoft's official position (published in a well-known blog post by Mark Russinovich) is that machine SIDs are not used by Windows in ways that cause problems in a domain, because domain-joined computers use a different, domain-unique SID for their computer account. However, in practice, many administrators and Microsoft Support engineers have documented real-world authentication failures caused by SID duplication, particularly with NTLM, local account authentication, and applications that use the local machine SID for licensing or access control. The safest approach is still to always run Sysprep when cloning.
Can duplicate SIDs cause problems even if the machines are on different networks?
If the machines are completely isolated on separate networks and will never communicate with each other or share the same Active Directory domain, duplicate SIDs are unlikely to cause authentication problems. The issues arise when duplicate SID machines interact, sharing the same domain controller, accessing the same file servers, or communicating through VPN or network peering. If there's any chance the networks will ever be merged or connected, fix the SIDs now rather than later.
Will running Sysprep break my installed applications?
It depends on the application. Most well-written applications store their configuration in ways that survive Sysprep. However, applications with per-machine licensing tied to the machine SID (some older Microsoft products, certain security tools, and some third-party enterprise software) may require reactivation or reconfiguration. Microsoft Office in volume licensing scenarios and some database engines are common examples. Always test Sysprep on a non-production clone first and document which applications need post-Sysprep attention before rolling it out at scale.
What's the difference between a machine SID and a domain SID?
A machine SID is generated locally by Windows for each installation and serves as the base for all local account SIDs on that machine. A domain SID is assigned by Active Directory when a computer account or user account is created in the domain. When a machine joins a domain, its domain computer account SID is entirely different from its local machine SID. Authentication in Active Directory uses domain SIDs, which is why Microsoft argues that machine SID duplication doesn't matter in domain environments. Local SIDs do matter for local accounts, local group membership, and some application licensing scenarios.
How do I fix duplicate SIDs on Azure VMs or cloud-based machines?
On Azure, the recommended approach is to create VM images using the Azure Image Builder or by generalizing the VM before capturing it as an image. For Windows, this means running Sysprep with /generalize before capturing. When you deploy from a generalized image in Azure, the platform's Guest Agent handles the OOBE process and generates a fresh SID automatically. If you've already deployed VMs from a non-generalized image on Azure, you'll need to run Sysprep on each affected VM, then re-register it with the domain. Azure's VM Custom Script Extension or Azure Automation can help you do this at scale.
After fixing duplicate SIDs, some users still can't log in. What else should I check?
First, purge Kerberos tickets on the affected clients with klist purge and retry. If that doesn't help, check for duplicate SPNs using setspn -X -F and resolve any conflicts. Also verify that DNS is resolving correctly and that there are no stale DNS records pointing to old IP addresses. Check the secure channel between the client and the domain controller with nltest /sc_verify:domain. Finally, review the Security event log for specific error codes, 0xC000006D, 0xC000006E, and 0xC0000064 each point to slightly different authentication failure modes and can guide you to the specific remaining issue.
Is there a way to detect duplicate SIDs proactively before they cause problems?
Yes, and you should absolutely build this into your environment. The PowerShell script in the Prevention section of this guide queries Active Directory for all computer accounts and groups them by SID, flagging any duplicates. Run this as a scheduled task daily and alert on any hits. You can also use Microsoft's System Center Configuration Manager (now Endpoint Configuration Manager) hardware inventory to collect machine SIDs and report on duplicates centrally. For smaller environments, the Sysinternals PsGetSid tool run against a list of machine names will do the job quickly.

Summary

Duplicate SIDs are one of those problems that are completely preventable but absolutely maddening when you're in the middle of them. The root cause is almost always the same: VMs or disk images cloned without running Sysprep first. The symptoms, Kerberos ticket failures, NTLM authentication errors, Event ID 4625 flooding your security log, look like they could come from a dozen different causes, which is why the diagnosis step is so important.

To recap the remediation path: confirm duplicate SIDs with PsGetSid, run Sysprep on the affected machines with the /generalize flag, clean up stale computer accounts and DNS records, rejoin the domain, purge Kerberos tickets, and restart authentication services. If problems persist, dig into SPNs, SID history, the secure channel, and the Group Policy cache.

Going forward, make Sysprep before cloning a non-negotiable part of your deployment process. Use platform-native templating features that handle generalization automatically. Build SID uniqueness checks into your post-deployment validation. These habits will save you from ever spending another afternoon chasing authentication errors back to a 30-second step someone skipped when they were in a hurry.

If you're still stuck after working through everything in this guide, check your event logs for specific Kerberos error codes and reference Microsoft's Kerberos troubleshooting documentation. The error codes are specific enough that they'll point you to the remaining problem pretty directly. You've got this.