When attempting to log into a domain-joined Windows machine, the following error is presented:
The Trust Relationship Between This Workstation and the Primary Domain Failed
The error can be caused by a number of reasons, some of which are (but not limited to):
- The computer name has been removed from the domain controller
- The computer name has been changed and it has not reflected on the domain controller
On the affected machine, remove the network connection and log in with the last known domain credentials.
Once logged in, reconnect the network cable and open Windows PowerShell as an administrator. (Press the Windows Button > type ‘PowerShell’ > right-click ‘Run as administrator’.
Enter the following commands:
$credential = Get-Credential
When the pop-up box appears, enter a domain-joined administrator username and password and Enter once done to proceed to the next command.
Reset-ComputerMachinePassword -Credential $credential
No error messages should be presented when entering the above commands.
Once complete, restart your machine and log into the machine with domain credentials.