To repair the domain trust relationship, sign in to the workstation with a local administrator account, open Windows PowerShell as administrator and run Test-ComputerSecureChannel -Repair -Credential CONTOSO\Admin with a domain account, then restart.
This guide covers what the error means, the machine account password behind it, every official repair route from PowerShell, nltest and netdom to a full domain rejoin, and how to stop the trust from breaking again.

Repair broken trust between computer and domain with PowerShell
Microsoft's documented fix rebuilds the secure channel in place. The computer keeps its domain membership, its computer object and its group memberships, so no rejoin is needed.
- Sign in to the workstation with a local administrator account, such as
.\Administratoror another local account in the Administrators group. - Select Start, type
PowerShell, right-click Windows PowerShell and select Run as administrator. - Run
Test-ComputerSecureChannel -Verboseto see the current state. False means the trust is broken. - Run
Test-ComputerSecureChannel -Repair -Credential CONTOSO\Admin, replacing the domain and user with an account that may reset computer passwords in your domain. - Type that account's password in the credential prompt and select OK.
- Run
Test-ComputerSecureChannelagain and wait for True. - Restart the computer and sign in with your domain account.
The -Repair switch removes and then rebuilds the channel that the NetLogon service uses. The account running PowerShell must be a member of the local Administrators group.
To pick a specific domain controller, add -Server "DC01.contoso.com" to both commands. This helps when one DC holds the newest copy of the computer password.
The trust relationship between this workstation and the primary domain failed
Windows shows this message at the sign-in screen when the computer can no longer authenticate itself to a domain controller. Each domain member holds a secret password for its computer account, and Active Directory holds a copy. When the two copies stop matching, the secure channel fails and domain sign-ins are refused.
Local accounts still sign in, and a domain user who signed in before can often use cached credentials.
| What you see | Where | What it means |
|---|---|---|
| "The trust relationship between this workstation and the primary domain failed." | Sign-in screen or Remote Desktop | Domain credentials are refused because the secure channel is broken |
| Event ID 3210, source NETLOGON | Event Viewer > System log | The computer could not authenticate with a named domain controller |
Trusted DC Connection Status Status = 5 0x5 ERROR_ACCESS_DENIED |
nltest /sc_query:contoso.com output |
The domain controller rejected the computer password |
| False | Test-ComputerSecureChannel output |
The channel between this computer and its domain does not work |
| Computer password older than the AD copy | Workstation | The machine was rolled back by a snapshot, backup or restore point |
| AD copy older than the computer password | Domain controllers | Replication failed, a DC was restored from backup, or the computer object was restored |
Event 3210 also names a second possible cause: another computer on the network using the same name. Check for a duplicate name before you repair a machine that keeps failing.

Machine (computer) account password in Active Directory
The computer account password is separate from any user password. The workstation changes it on its own schedule and stores it as an LSA secret, while Active Directory records the change in the computer object's pwdLastSet attribute. The domain member starts each change, not the domain controller.
Machine account settings are not the same as the domain password policy for users, even though both live under Security Settings in Group Policy.
| Setting or value | Default | Where to find it |
|---|---|---|
| Domain member: Maximum machine account password age | 30 days (values 1 to 999) | Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options |
| Domain member: Disable machine account password changes | Disabled | Same Security Options node |
| pwdLastSet (PasswordLastSet) | Updated at each successful change | Computer object in Active Directory; Get-ADComputer 'PC01' -Properties PasswordLastSet |
| Event ID 5823, source NETLOGON | Logged on each successful change | Event Viewer > System log on the workstation |
| cupdtime | Last change known to the workstation | HKLM\SECURITY\Policy\Secrets\$MACHINE.ACC, readable only by SYSTEM by default |
Comparing pwdLastSet in Active Directory with the workstation's last 5823 event tells you which side holds the newer password, and that decides where the real fix belongs.

How to log in when the trust relationship between workstation and domain failed
Every repair runs on the broken workstation, so you need a way in first. Microsoft confirms that local accounts and cached domain credentials still work.
| What you have | How to sign in | Then |
|---|---|---|
| A local administrator password | Sign in at the Windows sign-in screen as .\Administrator or PCNAME\localadmin |
Run the PowerShell repair with -Credential for a domain account |
| A domain account that signed in to this PC before | Sign in with that account's cached credentials | Make sure the network can reach a domain controller before you run the repair |
| Remote access from another domain computer | Use Invoke-Command with admin credentials |
Run Reset-ComputerMachinePassword inside the script block |
Test-ComputerSecureChannel vs nltest vs rejoin domain
| Your situation | Use this | Why |
|---|---|---|
| Windows 10 or 11 workstation or member server, PowerShell available | Test-ComputerSecureChannel -Repair -Credential |
Rebuilds the channel in place and returns True or False |
| Command Prompt only, or a script that must use cmd | nltest /sc_reset:contoso.com |
Removes and rebuilds the same NetLogon channel |
| Repair returns True but sign-in still fails, or you want a fresh password | Reset-ComputerMachinePassword |
Sets a new computer account password on a domain controller |
| The broken machine is a domain controller | netdom resetpwd |
Test-ComputerSecureChannel gives false results on DCs |
| Every repair fails, or the computer object was deleted | Remove the computer from the domain and join it again | Creates a new trust from scratch |
Fix trust relationship with nltest /sc_reset
Microsoft lists nltest next to the PowerShell cmdlet as the fix for both password-mismatch scenarios. Run it from an elevated Command Prompt while signed in with an account that has domain admin rights, or as a local admin with a domain admin's credentials available.
nltest /sc_reset:contoso.com
Removes, and then rebuilds, the secure channel that the NetLogon service established with a domain controller in contoso.com. Replace contoso.com with your domain name. Run nltest /sc_query:contoso.com afterwards to read the new state.
You should see: nltest /sc_query reports Trusted DC Connection Status Status = 0 0x0 NERR_Success and names the trusted domain controller. Restart the computer before you sign in with a domain account.
Reset-ComputerMachinePassword to fix the trust relationship
When the channel repair does not hold, reset the computer account password itself. The cmdlet changes the password the computer uses to authenticate to domain controllers and writes the new value to Active Directory.
- Sign in locally and open Windows PowerShell with Run as administrator.
- Run
Reset-ComputerMachinePassword -Server "DC01" -Credential CONTOSO\Admin, using a DC name and an account that may reset computer passwords. - Enter the password when prompted. The cmdlet prints nothing when it succeeds.
- Run
Test-ComputerSecureChannel -Verboseand look for True. - Restart the computer and sign in with a domain account.
To fix a machine you can still reach over the network, run it remotely: $cred = Get-Credential and then Invoke-Command -ComputerName "PC01" -ScriptBlock { Reset-ComputerMachinePassword -Credential $Using:cred }.
Reset domain controller machine password with netdom resetpwd
A domain controller needs a different tool. Microsoft notes that Test-ComputerSecureChannel returns false positive errors on DCs, and netdom resetpwd works only on the domain controller whose own password you reset. It does not reset member servers or remote machines, so do not use it on a workstation.
netdom resetpwd /server:DC02 /userd:CONTOSO\Admin /passwordd:*
Run it from an elevated Command Prompt on the affected DC. /server names a healthy domain controller to set the password against, /userd is the admin account and /passwordd:* prompts for its password instead of showing it. Netdom ships with the AD DS role and the RSAT AD DS tools.
You should see: Restart the DC after the reset, then run nltest /sc_query:contoso.com and check replication before you return it to service.
Fix trust relationship by rejoining the domain
Rejoining is Microsoft's last option, and a valid one. It removes the computer from the domain, then joins it again so a new computer account password is created. You need local admin rights on the machine and a domain account allowed to join computers.
- Sign in with a local administrator account and open Windows PowerShell as administrator.
- Run
Remove-Computer -UnjoinDomainCredential CONTOSO\Admin -WorkgroupName "TEMP" -PassThru -Verbose -Restart. - Sign in again with the local administrator account after the restart.
- Run
Add-Computer -DomainName contoso.com -Credential CONTOSO\Admin -Restart. - Enter the domain password when prompted and let the computer restart.
- Sign in with your domain account and check that Group Policy and mapped drives apply.
Domain join depends on correct time on the workstation, because Kerberos fails when clocks drift. If the clock is far off, sync it with the domain controller before you run Add-Computer.
How to check domain trust relationship with PowerShell
- Open Windows PowerShell as administrator on the workstation.
- Run
Test-ComputerSecureChannel -Verbose. - Read the result. True with the message "The secure channel between 'PC01' and 'contoso.com' is alive and working correctly" means the trust is healthy.
- Run
nltest /sc_query:contoso.comand look forNERR_Successnext to Trusted DC Connection Status. - Run
set | find /i "LOGONSERVER"in Command Prompt after a domain sign-in to see which DC authenticated you. - On a computer with the Active Directory module, run
Get-ADComputer 'PC01' -Properties PasswordLastSetand check the date is today.

Trust relationship failed keeps coming back
A repair that breaks again within days points at a cause outside the workstation. Microsoft groups the causes by which side holds the newer password.
Trust breaks after a virtual machine snapshot is reverted
The snapshot holds an older computer password than Active Directory.
- Check the System log for a gap in event dates or a recent Event ID 12 (Kernel-General) boot.
- Run
Test-ComputerSecureChannel -Repair -Credential CONTOSO\Adminand restart. - Take a new snapshot after the repair so a later revert does not repeat the problem.
Trust breaks after a system restore or bare metal backup restore
The restore rolled the LSA secret back to an older password.
- Look for Event ID 1208 (StartupRepair) in the System log or 8202 (System Restore) in the Application log.
- Repair the channel with
nltest /sc_reset:contoso.comor the PowerShell command. - Restart the computer.
Trust breaks after a power cut or crash
A password change was lost because the machine did not shut down cleanly.
- Look for Event ID 41 (Kernel-Power) or 6008 (EventLog) in the System log.
- Repair the secure channel and restart.
- On Windows Embedded devices with a write filter, plan password changes for maintenance windows.
Many computers lose trust at once
Active Directory holds the older password, after a DC restore, a replication failure or an authoritative restore of computer objects.
- Fix replication and domain controller health first, because the workstations cannot fix this side.
- Run
repadmin /showobjmeta * "CN=PC01,OU=Computers,DC=contoso,DC=com"and compare pwdLastSet across all DCs. - Once the values match on every DC, reset the secure channel on each affected computer and restart it.
Pooled VDI desktops fail after users sign out
Non-persistent machines reset to an image that carries an old computer password.
- Ask the VDI administrator to check that no VDI service stops Netlogon from changing the password.
- Update the base image during a maintenance window with
nltest /sc_change_pwd:contoso.com. - Consider the Disable machine account password changes policy only for these non-persistent images.
Test-ComputerSecureChannel -Repair says access is denied
PowerShell is not elevated, or the account cannot reset computer passwords in the domain.
- Close PowerShell and reopen it with Run as administrator.
- Add
-Credential CONTOSO\Adminwith an account that has rights over the computer object. - Run the repair again.
Repair fails and the computer name looks wrong
The computer name registry values hold a fully qualified domain name instead of the short name.
- Run
Reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName /v ComputerName. - Run
Reg query HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters /v hostname. - If either shows
PC01.contoso.cominstead ofPC01, correct the computer name, then rejoin the domain.

Should you disable machine account password changes?
No. Leave Domain member: Disable machine account password changes at its default of Disabled and the password age at about 30 days. Microsoft warns that longer intervals or disabled changes give an attacker more time to guess a machine account password. The setting exists for stockpiled pre-built computers, non-persistent VDI and embedded devices without a writable OS volume, not as a cure for trust errors or dual-boot setups.
Domain trust relationship FAQ
What causes the trust relationship between this workstation and the primary domain to fail?
The computer account password stored on the workstation no longer matches the copy in Active Directory. Snapshot reverts, system restore, backup restores, lost password changes after a crash and Active Directory replication problems are the common reasons.
Can you fix a domain trust relationship without rejoining the domain?
Yes. Run Test-ComputerSecureChannel -Repair -Credential DOMAIN\Admin in an elevated Windows PowerShell window, or nltest /sc_reset:domain in Command Prompt, then restart. Rejoining is only needed when these repairs fail.
Do you need domain admin rights to repair the trust relationship?
You need local administrator rights on the workstation and a domain account that may reset the computer's password. Microsoft's own repair examples run the commands with domain admin credentials passed through the -Credential parameter.
How often does a computer change its domain password?
Every 30 days by default. The interval is set by the Domain member: Maximum machine account password age policy, which accepts 1 to 999 days, and the change is started by the computer, not the domain controller.
Does Test-ComputerSecureChannel work on a domain controller?
No. Microsoft says the cmdlet works only on domain member computers and returns false positive errors on domain controllers. Use netdom resetpwd on the affected DC, or nltest, instead.
Can you still sign in when the trust relationship fails?
Yes, with a local account or cached domain credentials. Microsoft confirms both still work while domain sign-ins fail, so a local administrator account is the usual way in to run the repair.
What event ID shows a broken trust relationship?
Event ID 3210 from source NETLOGON in the System log. It says the computer could not authenticate with a named domain controller, which points to a password mismatch or a duplicate computer name.
Does netdom resetpwd work on a workstation?
No. Microsoft documents netdom resetpwd for resetting a domain controller's own machine account password only, run on that DC. Workstations and member servers use Test-ComputerSecureChannel, Reset-ComputerMachinePassword or nltest.



![How do I enable WebGL 2.0 on Microsoft Edge [guide]](https://techdows.com/wp-content/uploads/2026/12/How-do-I-enable-WebGL-20-on-Microsoft-Edge-guide-1-600x338.jpg)

