Fix: The Trust Relationship Between This Workstation and the Primary Domain Failed

Fix the trust relationship between this workstation and the primary domain failed: test the secure channel, repair it with Test-ComputerSecureChannel -Repair or nltest /sc_reset, reset the machine password, find the cause, or rejoin.

Home › Guides › Trust relationship failed

Last updated 18 November 2026

Quick answer

The computer's secure channel to the domain is broken: the computer account password stored on the machine no longer matches the one in Active Directory. Domain sign-ins fail, but a local account or cached credentials still work. Sign in with a local administrator account and, from an elevated prompt, run one of these with domain admin credentials (Microsoft's fix), then restart:

nltest /sc_reset:domain_name
Test-ComputerSecureChannel -Repair -Credential *

Run the PowerShell command in Windows PowerShell 5.1 (powershell.exe). Microsoft lists Test-ComputerSecureChannel, Reset-ComputerMachinePassword, Add-Computer and Remove-Computer among the cmdlets removed from PowerShell 7. If the repair doesn't work, reset the machine password; rejoining the domain is the last resort. If it keeps happening, find the cause before you fix it again.

Symptoms

The 3210 text names another computer using the same name as one possible cause. If you suspect that, find the other device's MAC address in your DHCP leases or ARP table and identify its vendor with the MAC Vendor Lookup. Look up 3210 and the other events below in the Windows Event ID Lookup.

Step 1: Check the domain controller and test the channel

  1. Find the DC the machine uses: set | find /i "LOGONSERVER" in cmd.exe. Check you can reach it, for example with Test-Connection to its fully qualified name. If there is no connectivity, fix the network path first.
  2. Test the channel. Test-ComputerSecureChannel returns $true if the channel works and $false if not; add -Verbose for detail or -Server "DCName.fabrikam.com" to test against a specific DC:
    Test-ComputerSecureChannel -Verbose
    VERBOSE: "The secure channel between 'SERVER01' and 'net.fabrikam.com' is alive and working correctly."

The cmdlet uses the NetLogon service, like NetDom.exe. It only works on domain member computers: Microsoft says it returns false positive errors on domain controllers, so use netdom.exe or nltest.exe to check and reset a DC's secure channel.

Step 2: Repair the secure channel

Test-ComputerSecureChannel -Repair -Credential *

or from cmd.exe:

nltest /sc_reset:domain_name

Use domain admin credentials and restart the computer afterwards. Microsoft's Azure VM article runs the same sequence: test, repair, then reset the machine password, then rejoin.

Step 3: Reset the machine account password

Reset-ComputerMachinePassword changes the computer account password the computer uses to authenticate to domain controllers. Microsoft's examples:

Reset-ComputerMachinePassword -Server "DC01" -Credential Domain01\Admin01

Or on a remote computer you can still reach with PowerShell remoting:

$cred = Get-Credential
Invoke-Command -ComputerName "Server01" -ScriptBlock {
    Reset-ComputerMachinePassword -Credential $Using:cred
}

Step 4: Rejoin the domain (last resort)

If the channel still won't come back, remove the computer from the domain and join it again (Microsoft's examples):

Remove-Computer -UnjoinDomaincredential Domain01\Admin01 -PassThru -Verbose -Restart
Add-Computer -ComputerName Server01 -LocalCredential Server01\Admin01 -DomainName Domain02 -Credential Domain02\Admin02 -Restart -Force

Microsoft calls rejoining a valid solution but notes it won't tell you why the channel broke. Keep a local administrator account with a strong, unique password (make one with the UUID / Password Generator) so you can still sign in when the trust fails.

Find the cause: which side has the newer password?

Microsoft's data collection steps compare two timestamps:

ResultCommon causes (Microsoft)Fix
Active Directory has the newer passwordThe VM was reverted to an old snapshot; the machine was restored from a bare metal backup or an old system restore point (System event 1208 or Application event 8202); an unexpected shutdown or power outage (events 41 or 6008) lost the change; pooled VDI desktops or machines built from an image with old secure channel data.Reset the secure channel on the computer (nltest /sc_reset or Test-ComputerSecureChannel -Repair -Credential *) and restart. VDI cases go to the VDI administrator.
The computer has the newer passwordActive Directory replication problems, a domain controller recovered from backup, or an authoritative restore of the computer object.Fix it on the Active Directory side first (replication, DC health, network); it can't be fixed from the client. Then reset the secure channel and reboot.

A snapshot revert leaves no specific event. Microsoft suggests looking for jumps in time in the System log (its example is events jumping from February to July on a machine in constant use) and checking Event ID 12 (Kernel-General, The operating system started at system time) or the uptime for a recent start. Microsoft also says to make sure these registry values hold the computer's short name, not its FQDN:

Reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName /v ComputerName
Reg query HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters /v hostname

Searching an exported netlogon.log for NlSessionSetup or NlChangePassword lines is quicker with a pattern; test one in the Regex Tester. More AD cmdlets are in the PowerShell Cheat Sheet.

Related tools and guides

Look up NETLOGON and System event IDs in the Windows Event ID Lookup, find more AD and computer cmdlets in the PowerShell Cheat Sheet, identify the vendor of a device that may be reusing the computer's name with the MAC Vendor Lookup, check a VM's address against the DC subnet with the IPv4 Subnet Calculator, test netlogon.log search patterns in the Regex Tester and create a strong local administrator password with the UUID / Password Generator. Related guides: find the source of an account lockout (4740), Event ID 4625 status and sub status codes and Netlogon event 5719.

FAQ

What causes the trust relationship between this workstation and the primary domain failed?

The secure channel between the computer and its domain is broken because the computer account password on the machine and in Active Directory no longer match. Microsoft's common causes are a machine with an older password (snapshot revert, backup or system restore, power loss) or Active Directory with an older password (replication problems or a restored DC).

How do I fix it without rejoining the domain?

Sign in with a local administrator account and run nltest /sc_reset:domain_name, or Test-ComputerSecureChannel -Repair -Credential * in Windows PowerShell 5.1, with domain admin credentials, then restart. If that fails, try Reset-ComputerMachinePassword.

Why is Test-ComputerSecureChannel not recognized?

It is a Windows PowerShell 5.1 cmdlet. Microsoft lists it, along with Reset-ComputerMachinePassword, Add-Computer and Remove-Computer, among the cmdlets removed from PowerShell 7, so run it in powershell.exe rather than pwsh.

Can I run Test-ComputerSecureChannel on a domain controller?

No. Microsoft says it only works on domain member computers and returns false positive errors on domain controllers. Use netdom.exe or nltest.exe to check and reset a domain controller's secure channel.

Why does the trust relationship keep breaking on the same machine?

Compare the computer's cupdtime and Event 5823 with the pwdLastSet value in Active Directory. If Active Directory is newer, look for snapshot reverts, restores, power loss or VDI images. If the computer is newer, check Active Directory replication and restored domain controllers.

Want the full kit?

Runbooks, checklists and helpdesk templates: IT Admin Packs on Gumroad.