August 05, 2020

PowerShell Solution for the trust relationship between this workstation and the primary domain failed

This is one possible solution for the error of 

trust relationship between this workstation and the primary domain failed

Note the solution will be using powershell run as an admin.

First you need to get an idea of when the user computer/workstation domain password was last synchronized. So I ran the following Powershell command:

get-adcomputer -Identity ProblematicComputerName -Properties PasswordLastSet
Which should give you a result like the following. Note the the only entry we care about is the PasswordLastSet field shown in the redbox here:
 


Next step is to reset that machine account password as a domain admin to fix that trust relationship without having to disjoin and rejoin the domain.

This is accomplished by running the following PowerShell command on the affected machine. Note that you have to run Powershell as admin here as well:
Reset-ComputerMachinePassword -Server dc1.your.domain.com -Credential domain\adminusr
Once you click or hit your Enter key to execute the command, you should get a prompt to enter your admin password. So fill-in your domain admin password and click OK.
Assuming all was done correctly, you should be returned to your PowerShell prompt.

So now you need to re-run your the first command to see the result of your command. So wait a minute for the command to synch across your DCs (assuming you have more than one DC) and re-run the command:

get-adcomputer -Identity ProblematicComputerName -Properties PasswordLastSet
and you should get an updated PasswordlastSet field value:



PowerShell Command reference:
Share:

0 comments:

Post a Comment