Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am deploying windows 7 images to our classroom PC's via WDS. Am trying to get the machine to auto join the domain through the unattend file but am running into an issue. The unattendfile is created with WSIM. The domain section to my understanding is done within the Specialise phase under 'unattendjoin' the part of which my unattend file looks like this:

 <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="x86"     publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="" xmlns:xsi="">

My issue is however is that once this is done, the machine can still not log into the domain. Instead an error is received on login:

The trust relationship between this workstation and the primary domain failed.

I can log into the default local machine admin, and I find that the domain is set to


It is only after this is set back to


and the computer restarted can I then log into the domain (basically joining the domain manually.)

Is there anyway I can get the machine to correctly join the domain from within the unattend file, so that we can start the deploy and walk away? We have many classrooms of PC's to deploy so it really needed.

share|improve this question
up vote 6 down vote accepted

It's kind of a weird design flaw in the Windows sysprep system. Joining the domain happens in the specialize phase. You can't be prompted to name the computer until the OOBE phase though. What I suspect is happening is that you are trying to name the computer in the out of box experience after you've already joined the computer to the domain. This breaks the computer account in the domain. You can solve this in 1 of 2 ways:

  1. Write a script to join the computer to the domain. Run this script after the OOBE. You'll likely want to specify an autologon in your sysprep answer file as well as a runonce to specify your script.

  2. Write a script to prompt for a computername to be run at the start of the specialize phase. You do this by running sysprep with the /quit flag then replacing the value of HKLM\System\Setup\CmdLine to point to your script. Have your script popup an input box for the computer name and then perform a find and replace on the answer file located in %windir%\panther\unattend.xml. When the script is done, make sure it continues the process by calling %windir%\system32\oobe\windeploy.exe

Check out this thread for some additional information and ideas:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.