Step 1 - Gain Access to the local computer. You can do this by unplugging the network adapter and then logging in as a alrealy known domain administrator account.  You will need local administrative rights to fix the domain trust.  You can also use a Local Administrative user account to gain access if you have one.


Step 2 - Fix the Security Issue. Right -Click Run as Administrator PowerShell.


Test-ComputerSecureChannel

- should return "False" indicating a problem.


Test-ComputerSecureChannel -Repair -Credential [domain]\[domainAdminUser]

- should return "True" indicating the security is fixed now.  


Step 3 - Reboot for good measure.


Notes - Loosing a domain trust usually means 

    1. the computer was offline for too long

    2. there is more than 1 computer with the same name connected to the domain

    3. IDK, what do you want from me...




Older Command Line way - Windows XP/Vista


Have a test VM or any machine that has been offline for too long and getting the "The trust relationship between this workstation and the primary domain failed" error?


If you can get into a local admin account you can run this command to fix it without having to rejoin the computer.  You can also login to the Domain Admin account on the machine if you unplug it from the network.


netdom.exe resetpwd /s:<server> /ud:<user> /pd:*


<server> = a domain controller in the joined domain
<user> = DOMAIN\User format with rights to change the computer password