Video Screencast Help

unattend.xml - prompt for machine name

Created: 15 Apr 2013 | 7 comments

When I ran XP builds I left the 'Computername' line out of sysprep. That way when the machine rebooted and went into setup it would prompt me to enter the computername. I'm looking to do this with windows 7 but so far had no success with the unattend.xml file. anyone got this going ?/able to point me in the right direction ?


Operating Systems:

Comments 7 CommentsJump to latest comment

jpellet2's picture

How are you deploying the image? Is it with WinPE and you want to name the machine with a different name or as if it was a new machine?

BugTastic's picture

Yep, I boot automation mode using PXE. I have tried tweaking the unattend.xml file with no luck. I dont want to have to predefine computers, cause that s just a pain for techs to do (having to go into BIOS, get mac address, take a note, create a text file and then import into the NS - c'mon - thats just riduclous for a new machine - I use Windows deployment toolkit at another customers and its so simple.)

We have a specific naming convention (not serial number which would make life easy.)

So I want it to prompt the tech for the hostname at the setup section.


jpellet2's picture

Great. If you need more assistance, let us know. As I mentioned in that other post, we like to use a vbscript during WinPE allowing us to change the name on the fly or use the name that is in the console. We then just replace a token inside the unattend file that gets added to the machine as its imaged. Works very well for us!

BugTastic's picture

Hi, allthough the script I mnetioned does work, its not ideal. Would you be able to share your script with me.? When it comes to scripts i'm a 2 line batch file guy then I run out of ides :-)

I did put a section into the ideas area. What would be good is when your selecting your image you can enter a hostname and also the OU you want to put it in. I've seen this done in SCCM (i would have thought it would have been an obvious inclsuion in a deployment tool)

Thanks again

jpellet2's picture

For a little context, here's how we image.

Because 7.1 can't use a UNC path for imaging we actually pull apart the built-in job into sub components.

  1. We boot to PXE
  2. Run a net use script to map a couple of drives, one of them includes the location where we store our unattend.xml file and some other scripts
  3. We copy the unattend.xml file that we want to use to X: which is the RAM drive in our case
  4. Inside that unattend.xml file we have made the computer name line look like this: <ComputerName>%COMPNAME%</ComputerName>
  5. We then run the vbscript attached which asks for a computername. If we don't supply one in a period of time or say we don't want to provide a new name, the script will bail out and the token in the unattend.xml file will be used to name the machine. If we change the name then the script will replace the token inside the unattend.xml file. We also move the file to a different name temporarily. You'll see why in a minute.
  6. Format the drive
  7. Deploy the image with Ghost (could use ImageX since we aren't using the built-in image job anyway)
  8. move the unattend.xml file to the right location. Move the unattend file that we altered above if it exists, otherwise just move the original
  9. Replace the token inside of the unattend.xml file, in its new location, if it exists. Remember the token will exist if we didn't replace it earlier.
  10. Manually run DeployAnywhere so that we can get the right drivers
  11. Reboot to Production and move on.

There are a lot of steps and most of them are handled by a single job if you don't need to use a UNC path. In any case you should be able to manipulate the job enough use the script.

ReplaceCompName.txt 2.84 KB