Short answer: the PC has lost its secure link to your Active Directory domain. Either its computer account was removed (often by a clean-up of devices that had been switched off for months) or its machine password no longer matches. Sign in with a local administrator account, then repair the link with Test-ComputerSecureChannel -Repair, or remove the PC from the domain and join it again if the account is gone.
An engineering consultancy called us one morning when a staff member’s own laptop had failed and the spare laptop he grabbed from the cupboard would not let him sign in. Windows showed “The security database on the server does not have a computer account for this workstation trust relationship”. Within an hour the business found the same error on several other spare laptops. Nothing was wrong with the laptops themselves. They had been switched off for so long that a routine clean-up of inactive computers had removed them from Active Directory. Here is what we found and how to fix it.
Fixed by the GCIT service desk team. Written up by Elliot Munro, CISO.
Symptoms
At the Windows sign-in screen, after entering a domain user name and password, sign-in fails with one of these messages:
The security database on the server does not have a computer account for this workstation trust relationship.
The trust relationship between this workstation and the primary domain failed.

People who have signed in to that PC before may still get in while it is disconnected from the office network, because Windows uses their cached sign-in. New users, or anyone signing in while the PC can see the domain controller, are refused. You may also see this described as “trust relationship failed”, “computer account missing from domain” or “domain trust error at login”.
Affected Software
- Platform: Windows 10 and Windows 11 PCs, and Windows Server, joined to an on-premises Active Directory domain (including hybrid joined PCs)
- Related Services: Active Directory Domain Services, domain controllers
Cause
Every domain-joined computer has its own account in Active Directory with a machine password that Windows changes automatically, every 30 days by default. Each time the PC talks to a domain controller, they check that password to confirm they trust each other. The two messages point to two different breaks:
- “The security database on the server does not have a computer account” means the computer’s account no longer exists, or is disabled. In our case a scheduled clean-up of computers that had not contacted the domain for a long time had removed the spare laptops.
- “The trust relationship … failed” means the account exists but the passwords no longer match. Typical triggers are restoring a PC from an old backup or snapshot, re-imaging a PC with the same name, or a PC that missed password changes while switched off and then fell out of step.
Resolution
You need a local administrator account on the PC (managed fleets usually have one stored in Windows LAPS or your IT team’s password manager) and a domain account that is allowed to join computers to the domain.
Option 1: The computer account still exists (repair the link)
- Sign in to the PC with the local administrator account (type
.\before the user name, for example.\localadmin). If you do not have one but someone has signed in to the PC before, unplug the network cable or turn off Wi-Fi, sign in with their cached domain account, then reconnect. - Open PowerShell as administrator and test the link:
Test-ComputerSecureChannel -Verbose. A result of False confirms the trust is broken. - Repair it:
Test-ComputerSecureChannel -Repair -Credential (Get-Credential)and enter a domain account with rights to join computers when prompted. - Run
Test-ComputerSecureChannelagain. It should now return True. Sign out and sign in as the domain user. No restart is usually needed.
Option 2: The computer account was deleted (rejoin the domain)
- Sign in with the local administrator account. Confirm you know that password before going further, because the next step removes domain sign-in.
- Open Settings > System > About, select Domain or workgroup, then Change, choose Workgroup, enter any name (for example WORKGROUP) and restart. In PowerShell this is
Remove-Computer -WorkgroupName WORKGROUP -Restart. - Sign in again with the local administrator account and join the domain:
Add-Computer -DomainName yourdomain.local -Credential (Get-Credential) -Restart, replacing the domain name with yours. - After the restart, sign in as the domain user. Existing users get their old profile back, because their user account did not change. A user who has never used that PC gets a new profile, so set up Outlook, Teams and any phone or line-of-business apps they need.
- If your domain has the Active Directory Recycle Bin turned on, an administrator can restore the deleted computer account instead and then use Option 1.
Important Notes
- Keep spare PCs out of automatic clean-ups. Inactive-computer clean-ups are good security practice, but they catch spares and loan laptops. Keep spares in their own organisational unit that the clean-up skips, or switch them on and connect them to the office network every few weeks.
- Tell IT when you write a PC off. The business we helped agreed to send a list of spares to keep and to tell us whenever a device was retired, so only genuinely retired computers are removed.
- Do not restore domain PCs from old images without planning. Restoring a snapshot that is months old rolls the machine password back and breaks the trust. Run the repair in Option 1 straight after a restore.
- Cloud-only PCs are different. PCs joined only to Microsoft Entra ID do not have this domain trust. Sign-in problems there have other causes, such as the web sign-in issue linked below.
Related Resources
- Microsoft Learn: Test-ComputerSecureChannel
- Microsoft Learn: Add-Computer
- Microsoft Learn: Active Directory Recycle Bin
- Fix: “We Can’t Open That Page Right Now” at Windows Sign-in
- What to Do When Windows Asks for a BitLocker Recovery Key
- Fix: RDP NLA “Domain Controller Cannot Be Contacted” Error
- GCIT hardware and device management
If spare laptops or loan devices keep failing at sign-in, or you want help with a safe device clean-up policy, get in touch with our team.