If you’ve worked with Microsoft Active Directory, then it’s very likely you’ve seen the following error message while trying to login to a server or workstation using domain credentials: “The trust relationship between this workstation and the primary domain failed.”
Typically, this is resolved by removing the server or workstation from the domain then rejoining it to the domain. However, the Reset-ComputerMachinePassword cmdlet may be used to change the computer account password that the computer uses to authenticate to domain controllers in the domain. For example, you may use the following syntax: Reset-ComputerMachinePassword -Server DC01 -Credential DOMAIN\– USER. As this is an example, you’ll need to substitute the DC01 field with a domain controller in your Microsoft Active Directory domain. Additionally, you’ll need to substitute the DOMAIN\– USER field with the domain and username of a user in your Microsoft Active Directory domain.
I believe this solution is preferable due to the fact that the Microsoft Active Directory computer object continues to use the same SID, remains in the appropriate OU, and remains in any necessary groups.
More information on this cmdlet may be found here.