Hyper-V The trust relationship between this workstation and the primary domain failed

Note this fix only works on Windows Server 2012/Windows 8 or later. A different method is required on Windows Server 2008R2 or earlier which involves the use of the NETDOM command.
For several years now I have been using Hyper-V for building out a virtual development environment on my laptop. Since I work as a consultant I have to handle a lot of different software scenarios. Some customers use web based VPN, others use software, sometimes I have to install a specific version of SQL while other times I remote into a workstation. On top of my customer needs I frequently do presentations at SQL Saturdays and for Pragmatic Works. All of these things combine to mean I have to be ready for just about anything in relatively short amounts of time.

“FIXED: Hyper-V trust relationship between the workstation and domain failed.”

I learned early on that rebuilding my laptop every time I needed to change a configuration for a given project or presentation was going to take up a huge chunk of my time so I started virtualizing. The issue that I run into from time to time comes into play when I have to roll back my VM to a previous checkpoint (aka snapshot). The problem manifests in an error message when attempting to log into Windows after applying a checkpoint and reads: The trust relationship between this workstation and the primary domain failed.
Hyper V The trust relationship between this workstation and the primary domain failed message
The solution for this particular error message is fairly simple but does require you to know the credentials for a local user account that is an administrator.


Here is a little bit of background information that will come in handy over the next few steps as we resolve the issue:

  • Domain Name: BSCORP
  • VM Computer Name: BS-WS-01
  • Domain Admin Account: BSCORP\Administrator
  • Local Admin Account: Bradley

First, log into the VM that is displaying the trust error message using a local account that is an administrator. In this case I’m going to log in using the account “Bradley”.
Hyper V The trust relationship between this workstation and the primary domain failed Local Admin Login
Second, run PowerShell as an administrator and run the Reset-ComputerMachinePassword command. Be sure to replace the credentials shown below with your own domain admin account. Also note that when you run this command a popup will appear asking you to input the password for the account specified in the PowerShell command.
Reset-ComputerMachinePassword -Credential BSCORP\Administrator
Hyper V The trust relationship between this workstation and the primary domain failed PowerShell
There is an optional parameter on the Reset-ComputerMachinePassword cmdlet to specify a domain controller in the environment as well. If you do not specify this parameter a domain controller is chosen for you. Reset-ComputerMachinePassword -Credential <DomainName\AccountName> -Server <DomainControllerMachineName>
Finally, restart the VM and log in with the original credentials that you were using when the domain trust error message appeared.

About the author

Bradley Schacht

Bradley Schacht is a Principal Program Manager on the Microsoft Fabric product team based in Jacksonville, FL. Bradley is a former consultant, trainer, and has authored 5 SQL Server and Power BI books, most recently the Microsoft Power BI Quick Start Guide. As a member of the Microsoft Fabric product team, Bradley works directly with customers to solve some of their most complex data problems and helps shape the future of Microsoft Fabric. He frequently presents at community events around the country, is a contributor to sites such as SQLServerCentral.com, and is a member of the Jacksonville SQL Server User Group (JSSUG).

2 comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Bradley Schacht

Bradley Schacht is a Principal Program Manager on the Microsoft Fabric product team based in Jacksonville, FL. Bradley is a former consultant, trainer, and has authored 5 SQL Server and Power BI books, most recently the Microsoft Power BI Quick Start Guide. As a member of the Microsoft Fabric product team, Bradley works directly with customers to solve some of their most complex data problems and helps shape the future of Microsoft Fabric. He frequently presents at community events around the country, is a contributor to sites such as SQLServerCentral.com, and is a member of the Jacksonville SQL Server User Group (JSSUG).

Follow Me