Reset a machine's trust with the domain after the Machine password has changed.

Often when performing a recovery of a domain joined machine, or rolling back to an old snapshot will result in an error message at logon "The trust relationship between this workstation and the primary domain failed".

This is likely caused by the Machine account in Active Directory having an updated password.

This can be fixed by a number of methods, as detailed below:
Reset the machine account using netdom:
From a command prompt type: netdom resetpwd /d:<DomainController> /ud:<Domain>\<Username> /pd:*

For example netdom resetpwd /d:DC01.contoso.com /ud:contoso\administrator /pd:*

2. Reset the account using PowerShell:
From a PowerShell window, type: Reset-ComputerMachinePassword -Server <DomainController> -Credential <Domain>\<Username>

For example: Reset-ComputerMachinePassword -Server DC01.contoso.com -Credential contoso\administrator

3. From Active Directory Users and Computers:
1. Open AD Users and Computers (dsa.msc).
2. Find the machine account that needs to be reset.
3. Right click the machine account and select Reset Account.