22 May 2018

How to Fix: ‘The trust relationship between this workstation and the primary domain failed’

I come across this error several times a year, typically when I start up a Virtual Machine that hasn’t been used in a while. Many people will recommend leaving and then re-joining the AD to resolve this problem – this is a terrible idea. I came across this solution a couple of years ago, and after having to search it for again today, I decided to post it here so I can find it more easily in the future.

To fix the error, reset the computer password using the netdom command line utility:

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

where:

  • <server> is a domain controller in the joined domain. You can get the domanin controller name using this command: nltest /dclist:domainname
  • <user>is in DOMAIN\User format, and has the required rights to change the computer password

I typically log on to the affected virtual machine using a local administrator account. I run the command above using  an elevated command prompt. Once the command succeeds, simply reboot the machine, and you will then be able to log on using a domain account as normal.