Restore trust between server and workstation without leaving and rejoining the domain

If a workstation is restored from a backup you will likely run into a message like ‘the trust relationship between this workstation and the primary domain failed’. The general advice will be leaving and rejoining the domain. However, there is a much safer method. You can start PowerShell as an administrator, and run the command below to regenerate the machine password that establishes the trust between the domain and the workstation.

reset-computermachinepassword -server [dcservername] -credential [yourdomainname\administrator]

Next, verify that trust has been restored by running:

nltest /sc_verify:[]

This should produce output something like below, to indicate success.

Trusted DC Name \\
Trusted DC Connection Status Status = 0 0x0 NERR_Success
Trust Verification Status = 0 0x0 NERR_Success
The command completed successfully
PS C:\