How to fix the trust relationship failed

Sometimes, especially when a computer does not connect to the domain for more than 30 days, it may lose the trust relationship with the domain and not allow us to connect to it.

The normal way would be to remove the pc from the domain and add it back, but there are two methods where it is not necessary to do this.

Option 1

  • The computer must be connected to the domain, either directly or via a VPN.
  • We open Powershell as administrator.
  • We type this command:
Test-ComputerSecureChannel -Repair -Credential DOMAIN\USER
  • It is necessary to enter the name of a domain administrator user in DOMAIN\USER.
  • When you press Enter, it asks for the password of the administrator user.
  • If the result is TRUE, everything is fixed.
  • We restart the computer and check that we can now enter to the domain correctly.

Option 2

  • The computer must be connected to the domain, either directly or via a VPN.
  • We open Powershell as administrator.
  • We type this command:
netdom reset PCName /Domain:DomainName /Server:DCName /UserO:AdministratorUser /PasswordO:*
  • When you press enter, it asks for the password of the administrator user entered.
  • If everything is correct, it tells us that “The secure channel of ….. has been re-established. The connection is established with the \\server…”.

With either method we avoid exiting and re-entering to the domain.