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

Bradley Schacht is a Principal Program Manager on the Microsoft Fabric product team based in Saint Augustine, FL. Bradley is a former consultant, trainer, and has coauthored 6 SQL Server and Power BI books, most recently Learn Microsoft Fabric. 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. Bradley gives back to the community through speaking at events such as the SQLBits, Fabric Community Conference, PASS Community Data Summit, SQL Saturdays, Code Camps, and user groups across the country including locally at the Jacksonville SQL Server User Group (JSSUG). He is a contributor on SQLServerCentral.com and blogs on his personal site, BradleySchacht.com.
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.
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".
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
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 -Server Finally, restart the VM and log in with the original credentials that you were using when the domain trust error message appeared.



