Reset computer account password to fix "trust relationship between this workstation and the primary domain failed" without rejoining.
Check Current Trust Status
Test-ComputerSecureChannel -Verbose
Returns False if trust is broken.
Reset the Secure Channel (Local Admin)
Log in with a local admin account, then run:
Reset-ComputerMachinePassword -Server "YourDCName" -Credential (Get-Credential)
Enter domain admin credentials when prompted. Replace YourDCName with your domain controller hostname.
Alternative: Repair Without DC Name
Test-ComputerSecureChannel -Repair -Credential (Get-Credential)
Auto-locates a DC and repairs the channel in one command.
Force Reset via netdom (Legacy)
netdom resetpwd /server:YourDCName /userd:DOMAINAdmin /passwordd:*
Prompts for password. Works on older systems without full PowerShell AD module.
Verify
Test-ComputerSecureChannel -Verbose
Expected output: True
Reboot recommended but not always required.
Techworks Blog