Re-establish trust with Active Directory domain

If you ever had to restore a domain joined machine, or a laptop/desktop that didn’t connect to the domain in a long time, it might happen that the domain relationship is broken. When you try to logon you get the following error:

“The trust relationship between this workstation and the primary domain failed.”

What you can do is leave the domain, and rejoin the domain, however, it is better to reestablish the trust relationship. Log in on the computer with a local admin account and run in a privileged PowerShell window the below script. After running a reboot should do the trick.

Use the following command to re-establish the trust with the domain:

$domaincontroller = “Name of the domain controller”
$credential = Get-Credential

Reset-ComputerMachinePassword -Credential $cred -Server $domaincontroller

Leave a Reply

Your email address will not be published. Required fields are marked *