Fix Domain Trust Relationship in PowerShell
Reset computer account password to fix "trust relationship between this workstation and the primary domain failed" without rejoining.
Check Current Trust Status
Test-ComputerSecureChannel -VerboseReturns 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:DOMAIN\Admin /passwordd:*
Prompts for password. Works on older systems without full PowerShell AD module.
Verify
Test-ComputerSecureChannel -VerboseExpected output: True
Reboot recommended but not always required.
Related Reading
Need hands-on help? Contact RainCity Techworks.