How to fix “the trust relationship between this workstation and the primary domain failed”

If you’ve restored or “rolled back” a PC running Windows 7, Windows 8, or Vista then you may have run into this error message  “the trust relationship between this workstation and the primary domain failed”.
In order to fix this the first thing you need to do is login with a local account as opposed to a domain account.  The reason for this is simple, the server no longer trusts you so you can’t authenticate any domain users.
To do this on Windows7 for the username you will need to use .administrator or .USERNAME  (where USERNAME) is a valid local user name.  Unfortunately if you do not know these then you must use a Windows7 password reset utility first.
Once you have logged in as a local user you need to download RSAT for windows7 this will allow you to run the netdom command-
Once it is downloaded you must go into the control panel to actually enable it.  Go to add remove windows components then browse to this location.
In the treeview, go to Remote Server Administration Tools -> Role Administration Tools -> AD DS and AD LDS Tools and select AD DS Tools. Click OK.
Once this is complete run the following command to reset the trust with your server
netdom.exe resetpwd /s:DomainControllerName /ud:domainDomainAdmin /pd:* 
Replace DomainControllerName with the name of a valid domain controller and replace domainDomainAdmin with your domain name and valid domain administrator account.  You are now finished.  Reboot the PC.
There is also a second method for fixing this error.  It is to login as a local administrator account remove the PC from the domain reboot and then add it back.  This will however reset your users’ profiles.

Install Windows 7 in one VHD file

This is a pretty straightforward process. 


  1. First thing you want to do is right click on command prompt and run as administrator.
  2. Once the command prompt is open type the following command create vdisk file=c:VMswindows7.vhd type=fixed maximum=25000  Once you type this command you will see a balloon that says Microsoft VHD HBA
  3. Next thing you want to do is select the vdisk by issuing the following command sel vdisk file=c:VMswindows7.vhd
  4. Next attach to the vdisk attach vdisk
  5. If you issue the list disk command it will show you your hard drive and the vhd you just created.
  6. Next sel disk 3 which will select your vdisk
  7. Then create part primary  – create the primary partition
  8. select part 1 – Select the partition
  9. active – This makes the partition active
  10. format fs=ntfs quick – This command formats your disk ntfs quick
  11. assign – This command assigns the disk
  12. You can now exist diskpart

Boot to Windows 7 DVD

  1. Now boot to your Windows 7 DVD.
  2. Once you’re on the install now step push shift+f10 – this will open the command prompt
  3. Type the following commands below
  4. diskpart
  5. select vdisk file=d:virtualwin7.vhd
  6. attach vdisk
  7. Now do a custom install and select your mounted VHD file

Boot to OS

  1. Now when you boot your PC you should see 2 windows7 options in the boot loader you can fix this by booting into either OS
  2. bcdedit /v
  3. Copy the identifier for the VHD file it is the long string of characters surrounded by the {XXX}
  4. Then issue this command to change the description in your boot loader
  5. bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} description “Windows 7 – VHD file”
  6. The last step if you would rather see the VHD install at the bottom of the boot loader issue this command
  7. bcdedit /displayorder {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} /addlast


Congratulations you have just installed Windows 7 to a VHD file.