Skip to content

Est. 2011ยทMicrosoft Partner 7033487ยทDelivery under 3 minยทSupport 7 days a week

Your vault is empty.

Free Fix 1789

Error 1789 trust relationship failed: rebuilding a broken secure channel

11 min read Updated October 4, 2026 Windows Server: AD, DNS & Group Policy

Fix it now

Microsoft publishes 1789 as “The trust relationship between this workstation and the primary domain failed”, with the sign-in message adding that you can sign in using a local user or cached credentials. Despite the wording it is not about a trust between domains: this computer’s account password no longer matches the copy in Active Directory. Repair it in place rather than rejoining.

Run these on the affected machine, signed in locally, in an elevated Command Prompt

nltest /sc_query:corp.example.com
nltest /sc_reset:corp.example.com
  1. Sign in with a local administrator account, or a domain account that still has cached credentials.
  2. Test the channel. Microsoft’s documented output for a broken one is Trusted DC Connection Status Status = 5 0x5 ERROR_ACCESS_DENIED.
  3. Reset it with nltest /sc_reset:<domain>, or from PowerShell with Test-ComputerSecureChannel -Repair -Credential *. Both are Microsoft’s documented repairs for this case.
  4. Restart the computer, which Microsoft gives as the step after the reset, then sign in with a domain account.

Test-ComputerSecureChannel -Repair requires membership of the local Administrators group on the machine you are repairing, and the credential you supply needs rights over the computer object in the domain.

If a domain sign-in succeeds after the restart, you are done. If not, the next section covers what the secure channel is and the four ways the two copies drift apart.

Why it happens

Every domain-joined computer holds an account in Active Directory with a password, exactly as a user does. Windows keeps its copy as an LSA secret; the directory keeps its copy on the computer object, timestamped as pwdLastSet. Net Logon changes the password on a schedule and writes both. The two copies must agree for the machine to open a secure channel to a domain controller, and that channel is what carries authentication on the computer’s behalf. Without it the machine cannot ask a domain controller to authenticate anybody, including you.

Microsoft describes the failure in two directions and they are worth naming separately, because the remedy differs. Either the client holds an older password than Active Directory, or Active Directory holds an older password than the client. The first is the common case and is what a snapshot revert, a bare-metal restore, a system restore point, an unexpected shutdown or a non-persistent virtual desktop produces: the machine’s copy goes back in time while the directory keeps the newer one.

The corroborating evidence sits on the machine and on the domain controller. Microsoft documents Net Logon event 3210 for this scenario: this computer could not authenticate with the named domain controller and therefore might deny logon requests, which may be caused by another computer on the same network using the same name or by the password for this computer account not being recognised. In the Net Logon log the same failure reads as a session setup that cannot authenticate, followed by “new password is bad, try old one”.

That last line is why some of these heal themselves. Windows keeps a current and a previous password, so a short-lived mismatch can be forgiven. Outside that window the channel fails for good, and you see 1789 at the sign-in screen. Two neighbouring codes narrow it further: 1787, ERROR_NO_TRUST_SAM_ACCOUNT, is “The security database on the server does not have a computer account for this workstation trust relationship”, and 1786, ERROR_NO_TRUST_LSA_SECRET, is “The workstation does not have a trust secret”.

The machine was reverted, restored, or switched on after a long time off

You have this one if It worked before the revert or restore, and the computer object’s password timestamp in the directory is newer than the machine believes.

  1. Sign in locally and run nltest /sc_reset:<domain>, or Test-ComputerSecureChannel -Repair -Credential * in PowerShell.
  2. Restart the computer.
  3. Sign in with a domain account to confirm.

Microsoft lists the causes for this direction explicitly: reverting a virtual machine to an old snapshot, restoring from a bare metal backup, restoring from an old system restore point, an unexpected shutdown or power outage, and non-persistent pooled virtual desktops.

The computer object was deleted or disabled

You have this one if Error 1787 rather than 1789, or the object simply is not in the directory.

  1. If it is merely disabled, enable it and repair the channel.
  2. If it was deleted and the Active Directory Recycle Bin is enabled, restore the original object rather than creating a new one, which keeps the security identifier.
  3. If it cannot be restored, pre-stage a replacement in the correct organisational unit and rejoin, and expect anything granted to the old identifier to need re-granting.

Two machines are using the same name

You have this one if Event 3210 on the client, and the failure keeps coming back after a successful repair.

  1. Microsoft names this cause in the event text itself: another computer on the same network using the same name.
  2. Check the registry values Microsoft points at – the ComputerName value under the ComputerName key, and the Tcpip parameters hostname – and confirm they hold the short computer name rather than a fully qualified name.
  3. Find and rename the duplicate before repairing again, or the repair will hold only until the other machine next changes the password.

Clock skew stops the repair authenticating

You have this one if The repair command itself fails to authenticate, and the time source reads Local CMOS Clock or shows a large offset.

  1. Run w32tm /resync on the machine and recheck with w32tm /query /status.
  2. If it is a virtual machine, stop it taking time from the hypervisor host so the domain hierarchy owns its clock.
  3. Retry the reset once both ends agree.

/force is not a parameter of w32tm /resync. The documented parameters are /computer, /nowait, /rediscover and /soft.

Full reference

The codes

Code Symbolic name Microsoft’s published text
1789 ERROR_TRUSTED_RELATIONSHIP_FAILURE The trust relationship between this workstation and the primary domain failed
1787 ERROR_NO_TRUST_SAM_ACCOUNT The security database on the server does not have a computer account for this workstation trust relationship
1786 ERROR_NO_TRUST_LSA_SECRET The workstation does not have a trust secret
0xC000018B – Not published by Microsoft on any page reached. Treat it as the LSA-level counterpart of the two errors above
Event ID 5805 – Not published by Microsoft. The documented Net Logon entry for this failure is 3210

The two directions, and how to tell them apart

Which copy is older What caused it What to do
The client’s Snapshot revert, bare-metal restore, restore point, unexpected shutdown, non-persistent VDI Reset the channel from the client and restart
Active Directory’s A domain controller restored to a previous state, or replication problems Fix the directory side first; resetting the client against a stale DC just moves the problem

That second row is the one people miss. If the domain controller you are repairing against has itself gone back in time, or if the computer object has not replicated, a successful reset writes a password that the next domain controller the machine talks to will not recognise. Where the estate has more than one domain controller, target a healthy one explicitly with Reset-ComputerMachinePassword -Server <dc> and confirm the change has replicated before declaring victory.

The repair commands

Command What it does
nltest /sc_query:<domain> Reports the secure channel state and which domain controller it points at
nltest /sc_reset:<domain> Microsoft’s documented reset for a client holding an older password than the directory
Test-ComputerSecureChannel -Verbose Verifies the channel and returns true or false, with detail
Test-ComputerSecureChannel -Repair -Credential * Removes and rebuilds the channel established by the Net Logon service. Requires local Administrators membership
Reset-ComputerMachinePassword -Server <dc> -Credential <cred> Resets the machine account password against a domain controller you name

What not to do first

  • Do not leave the domain and rejoin as an opening move. Rejoining under the same name after removing the object typically produces a new object with a new security identifier, so memberships and anything keyed to the old identifier are lost. A repair keeps the original object.
  • Do not delete the computer object to make the repair work. That converts a five-minute fix into a rebuild.
  • Do not disable the machine’s automatic password change to stop this recurring. It is a security decision dressed as a convenience, and it does not address why the two copies diverged.
  • Do not repair against whichever domain controller answers first if you already know one of them was restored.

Checking the name registry values

Microsoft’s secure channel guidance includes a check that is easy to skip and occasionally the whole answer: confirm that the ComputerName value under the ComputerName key, and the hostname value under the Tcpip parameters key, both hold the actual computer name rather than a fully qualified one. A machine whose name values disagree with what it registered in the directory behaves exactly like a machine whose password is wrong, and no number of resets will settle it.

Activation is a separate system

A reverted or restored machine often shows an activation prompt at the same time as this error, and the two get bundled together. They are unrelated. Repairing the secure channel does not activate Windows, and re-entering a product key does not repair the secure channel. Fix them independently, and be suspicious of any advice that treats one as the cure for the other.

Every code this article covers

Code What it points at Source
1789 ERROR_TRUSTED_RELATIONSHIP_FAILURE: the trust relationship between this workstation and the primary domain failed. The sign-in message adds that you can sign in with a local user or cached credentials Microsoft Learn
1787 ERROR_NO_TRUST_SAM_ACCOUNT: the security database on the server does not have a computer account for this workstation trust relationship Microsoft Learn
1786 ERROR_NO_TRUST_LSA_SECRET: the workstation does not have a trust secret Microsoft Learn
0xC000018B Seen in security detail alongside the machine trust failures above. No acceptable vendor page publishes a meaning for it; read it as the same class of failure rather than as a distinct diagnosis not published by the vendor
Event ID 5805 Reported on domain controllers alongside failed computer session setups. Microsoft does not publish it; the documented Net Logon entry for this failure is Event 3210, which names the domain controller and the two candidate causes not published by the vendor

Confirm the fix worked

  1. nltest /sc_query:<domain> names a domain controller and reports success rather than ERROR_ACCESS_DENIED.
  2. Test-ComputerSecureChannel returns true without the repair switch.
  3. A domain user with no cached credentials signs in at the console after a restart.
  4. No new Net Logon event 3210 appears on the machine over a working day.
  5. gpupdate /force completes on the repaired machine.

Questions people ask about this

Do I have to leave the domain and rejoin?

Usually not, and it is worth avoiding. Microsoft’s documented repairs are nltest /sc_reset:<domain> and Test-ComputerSecureChannel -Repair, followed by a restart. Both keep the existing computer object, its memberships and its security identifier.

Does the repair need a reboot?

Microsoft’s documented procedure ends with restarting the computer, so plan on it. Sign out and back in at minimum, and restart if services on the machine run under domain accounts.

Why does it keep coming back?

Either something keeps putting the machine back in time – a snapshot, a restore point, a non-persistent desktop – or two machines share a name. Microsoft names the duplicate name case in the text of event 3210 itself, and it is the one that survives every repair.

Does this affect Windows activation?

No. Activation and domain membership are separate systems that happen to break together after a virtual machine revert, which is why they get confused. Repairing one does nothing for the other.

Which domain controller should I repair against?

A healthy one, named explicitly, if you have any reason to think the one the machine picked has itself been restored or is behind on replication. Reset-ComputerMachinePassword -Server <dc> lets you choose.

Related error codes

Was this article helpful?

Your feedback helps us improve our documentation.

Related articles

License Error DFSR Event ID 5002: SYSVOL partners cannot hold an RPC session open Free Fix Error 0x8009480F: the request lacks the DNS name the template demands Free Fix Event ID 408: the DNS server could not open a socket on its listen address Free Fix Event ID 7062: the DNS server sent a packet to itself in a forwarding loop
โ† Back to Knowledge Base