Use PowerShell to reset computer trusts

Every now and again a computer will fall off the domain. This is the dreaded "The trust relationship between this workstation and the primary domain failed" error. This can happen for a number of reasons. Sometimes a laptop has been away too long or a workstation has been turned off too long. Sometimes is happens for no good reason. Since the Windows NT 4.0 days I have been using to command netdom to reset the trust between the computer account and the domain. There is now a better way using PowerShell.

You can test the secure channel on a computer but typing:
Test-ComputerSecureChannel You will get a result of true or false. True means that the secure channel is working, false means it is broken.

To reset the secure channel on a computer run PowerShell as administrator and type:

Test-ComputerSecureChannel -credential domain\user -repair