You log in with your domain account and get `The trust relationship between this workstation and the primary domain failed.` Your password is fine. The computer's own password is not. Every domain PC holds a machine account in Active Directory, and that secret rotates every 30 days. Leave a laptop offline two months and the copies drift. Check the name first with this guide.
Quick steps
- Log in with a local admin account, not your domain one.
- Run Test-ComputerSecureChannel to see if the channel is broken.
- Fix it with -Repair and domain credentials.
- Reset the machine password with Reset-ComputerMachinePassword.
- Use netdom resetpwd if that route fails.
- Rejoin the domain only as a last resort.
- Hand it to IT if you lack the rights.
Things you'll need
- A local administrator account on the PC
- Domain credentials allowed to reset computer objects
- The exact domain name, for example contoso.com
- Network line of sight to a domain controller
Step-by-step
Method 1 of 3: Confirm the Channel Is Actually Broken
Download image
Step 1: Log In With a Local Administrator
Type `.\LocalAdmin` or `<MachineName>\LocalAdmin` at the logon screen. That forces a local logon, not a domain one. Repair never works from the broken domain account.
Download image
Step 2: Check the Clock Before Anything Else
Run `w32tm /query /status` and compare the time with your phone. Kerberos rejects requests once the skew passes 5 minutes, and a dead CMOS battery on an old desktop causes exactly this. A correct clock can fix it alone.
Download image
Step 3: Test the Secure Channel
In an elevated PowerShell window run `Test-ComputerSecureChannel`. `True` means the channel is fine and the fault sits elsewhere. `False` means the machine password is out of sync, and that secret rotates every 30 days by default.
Source: Microsoft Learn — DISM Overview · See also Microsoft Learn — Debug system error codes · Read next: Reinstall Windows 11 Without Losing Files
Download image
Step 4: Confirm the Domain Name
Run `systeminfo | findstr /i domain` or `echo %USERDOMAIN%` and write the exact name down. A typo in the domain name during the repair fails with a misleading error about credentials rather than about the domain itself. Write it down exactly.
Download image
Step 5: Check Whether the Machine Account Exists
Ask IT to look for your computer name under the default Computers container. If the object was deleted, every local repair command will fail and a rejoin is the only route left. Ask before you repair.
Download image
Step 6: Find a Domain Controller With nltest
Run `nltest /dsgetdc:contoso.com` with your real domain name. You want a DC name and an address back. If it fails, you are not on the corporate network, and no local command will work until you are.
Method 2 of 3: Repair the Machine Account Password
Download image
Step 7: Run the Repair Switch
Run `Test-ComputerSecureChannel -Repair -Credential (Get-Credential)` and enter an account that can reset computer objects. The cmdlet writes a new machine password and re-creates the channel. It prints `True` when the repair landed.
Download image
Step 8: Handle the Credential Failure
If it returns `False` or throws an access error, the account you typed cannot write to the computer object. That is permissions, not a broken command. Ask for an account with delegated rights, or let IT run this step on your behalf.
Download image
Step 9: Reset the Password Directly
Run `Reset-ComputerMachinePassword -Server DC01 -Credential (Get-Credential)` with a real controller name. Unlike the repair switch, it resets the password without testing the channel first. Use it when the test itself errors out.
Source: Microsoft Learn — netdom resetpwd · See also Microsoft Learn — DISM Overview · Read next: Reinstall Windows 11 Without Losing Files
Download image
Step 10: Fall Back to Netdom
Run `netdom resetpwd /Server:DC01 /UserD:CONTOSO\admin /PasswordD:*`. Netdom is the legacy tool: it needs both a user and a password argument, and it ships with RSAT only. The asterisk keeps the password out of your history.
Download image
Step 11: Restart Before You Test Again
Reboot the machine. The new machine password is written to the local secrets store at shutdown, and some cached tickets still hold the old one. Testing before that restart gives you a false `False` and wasted time.
Download image
Step 12: Test With a Network Resource
After the restart, open `\\dc01\netlogon` or any share you have rights to. A credential prompt means the channel is up. Silent access denied means move to the rejoin.
Download image
Step 13: Resync the Time Service
Run `w32tm /resync /force`. If the trust fails again within an hour, clock drift is the usual cause. Point the machine at the domain hierarchy with `w32tm /config /syncfromflags:domhier /update` to end the pattern.
Method 3 of 3: Rejoin the Domain, and Know When to Stop
Download image
Step 14: Save the Profile Path First
Before you leave the domain, note `C:\Users\<name>` and copy anything irreplaceable to a share. Rejoining produces a new local profile in many cases, and the old folder stays orphaned under a modified name. That surprises people.
Download image
Step 15: Leave the Domain
Open `System Properties → Computer Name → Change` and switch to Workgroup, or use `Settings → Accounts → Access work or school`. Pick a workgroup name that is not already used on the network. Reboot when prompted.
Source: Microsoft Learn — chkdsk command · See also Microsoft Learn — netdom resetpwd · Read next: Reinstall Windows 11 Without Losing Files
Download image
Step 16: Delete the Stale Computer Object
Ask IT to remove the old computer account from AD before you rejoin, or you inherit the same broken object. This single step is why rejoining sometimes fixes nothing. Confirm the deletion first.
Download image
Step 17: Rejoin With Domain Credentials
Return to `System Properties → Computer Name → Change`, choose Domain, and enter the name plus an account allowed to join computers. A message about the join failing here usually means the name is taken or the rights are missing. Expect one reboot.
Download image
Step 18: Reattach the Old Profile Folder
Sign in, then copy the old folder contents into the new profile and take ownership with `icacls`. Domain profiles are keyed to the account SID, and a rejoin can hand you a new one, so expect to redo shortcuts and mail settings. Expect to redo shortcuts.
Download image
Step 19: Stop Before You Rejoin Blindly
Stop if IT has not confirmed the machine account was deleted, if you cannot log in locally, or if the disk is BitLocker-encrypted and you have no recovery key. Rejoining a machine you cannot log into is how a fixable PC becomes a reimage. Ask before you act.
Tips
- A time skew over 5 minutes breaks Kerberos on its own and looks exactly like this. Run w32tm /resync first.
- Cached domain credentials keep you logging in for a while after the trust breaks. That window is why users notice late.
- Test-ComputerSecureChannel returns True or False and nothing else. Do not read more into it.
- Laptops that travel should hit the VPN before the 30-day window closes. Do it early.
Warnings
- Leaving and rejoining the domain breaks the link between the account and its local profile folder. Copy first.
- Never run -Repair over a public network. Use a wired corporate link.
- A duplicated computer name on the domain re-breaks the trust within hours. Check before rejoining.
- If the machine account was deleted in AD, no local command fixes it. Only IT can recreate it.
Frequently asked questions
Can I still log in?
Usually yes. Cached credentials keep working for a while after the trust breaks. A password change while offline can wipe that cache.
Do I need domain admin rights?
To reset the machine password, yes. A local admin can run the commands, but they fail without rights over the computer object.
Will this delete my files?
Repairing the channel does not touch them. Leaving and rejoining the domain does break the local profile association.
Why does it happen every few months?
The laptop keeps going offline for longer than the 30-day rotation. Fix the VPN habit, not the computer.
References
- Microsoft Learn — Test-ComputerSecureChannel. https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/test-computersecurechannel
- Microsoft Learn — Reset-ComputerMachinePassword. https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/reset-computermachinepassword
- Microsoft Learn — netdom. https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/netdom
- Microsoft Support — Windows help and learning. https://support.microsoft.com/en-us/windows
Every guide is reviewed against its sources. See our editorial policy.
Reader comments
0 so farFinished this guide? Tell other readers what worked, what didn't, and what you would change.