Jump to content

Dynamically create the Unattend.xml


ChrisBaksa

Recommended Posts

I was wondering if anyone was dynamically creating the Unattend.xml for their Windows 2008/Vista installs.

I'm looking for information on how people are creating the unattend.xml thru scripted methods. Specifically... I'm looing to do this thru VB Script.

It seems Micosoft has made this process a nightmare. The old Unattend.txt was easy.

Aything helps.

Chris

Link to comment
Share on other sites


I plan to do this for our unattended installs. We currently do this for Windows 2000 and Windows Server 2003 OS versions for unattend.txt, so I plan to extend it for Windows Server 2008 as well for unattend.xml.

Simple VB code to create a FileSystemObject we use is as follows:

Set objFS = CreateObject("Scripting.FileSystemObject")

Set objNewFile = objFS.CreateTextFile("c:\unattend.xml")

objNewFile.WriteLine "<?xml version=" & chr(34) & "1.0" & chr(34) & " encoding=" & chr(34) & "utf-8" & chr(34) & "?>"

objNewFile.WriteLine "<unattend xmlns=" & chr(34) & "urn:schemas-microsoft-com:unattend" & chr(34) & ">"

objNewFile.WriteLine "< <servicing>"

etc...

objNewFile.Close

(as you can't use the double quote charater directly, you have to substitutue it for " & chr(34) & " in the code so that when it writes out the file it fills in the correct character.)

Just produce and validate your original unattend.xml file in Windows System Image manager from WAIK and then use it as the template for the VBscript to dynamically produce.

Link to comment
Share on other sites

  • 1 month later...
I plan to do this for our unattended installs. We currently do this for Windows 2000 and Windows Server 2003 OS versions for unattend.txt, so I plan to extend it for Windows Server 2008 as well for unattend.xml.

Simple VB code to create a FileSystemObject we use is as follows:

Set objFS = CreateObject("Scripting.FileSystemObject")

Set objNewFile = objFS.CreateTextFile("c:\unattend.xml")

objNewFile.WriteLine "<?xml version=" & chr(34) & "1.0" & chr(34) & " encoding=" & chr(34) & "utf-8" & chr(34) & "?>"

objNewFile.WriteLine "<unattend xmlns=" & chr(34) & "urn:schemas-microsoft-com:unattend" & chr(34) & ">"

objNewFile.WriteLine "< <servicing>"

etc...

objNewFile.Close

(as you can't use the double quote charater directly, you have to substitutue it for " & chr(34) & " in the code so that when it writes out the file it fills in the correct character.)

Just produce and validate your original unattend.xml file in Windows System Image manager from WAIK and then use it as the template for the VBscript to dynamically produce.

Ok.. here is the big question.

First let me describe my process.

I PXE boot to WINPE...

I Partition and format drive...

I Use ImageX to deploy a custom Image (I used the Sysprep /OOBE /Generalize /Shutdown switches and then created my image)

I Now I copy my PNP drivers to the drive (unattend.xml has the locations in it)

Now my Unattend.xml is created via scripting and has my regionalization, IP address, pnp driver paths and other information.

What do I do with the file? Does it get rename?

Where does it go so when WInPE rebots and teh host boots up it is used and builds with those settings?

I assume it has to be placed somewhere on the host's hard drive. But where?

I can't find this information anywhere.

Thanks.

Chris

Link to comment
Share on other sites

Hi,

I am also using the MDT (Microsoft Deployment Toolkit) as a build environment, which would create "generic" images..

Works just fine for me.... and free of charge! To answer your questions listed above (all of them are addressed within the MDT framework):

Q1: PXE boot to WINPE...

A1: It is also what MS is doing within MDT

Q2: I Partition and format drive...

A2: Check

Q3: I Use ImageX to deploy a custom Image (I used the Sysprep /OOBE /Generalize /Shutdown switches and then created my image)

A3: Exactly what MS are doing within MDT

Q4: I Now I copy my PNP drivers to the drive (unattend.xml has the locations in it)

A4: I personally use a vbscript for reading the registry key that is created if booted over WDS, to determine the location container for the driver package, and apply it using the imagex.exe commando, not from within the unattend.xml even if possible. The drivers can be injected with drvinst or Package Manager using CLI/WSH. MDT also has a MS solution for it even though I find it somewhat troubblesome.

Q5: What do I do with the file?

A5: The name of the file must be unattend.xml or autounattend.xml according to MS documentation or the panther (setup engine) engine will skipp the exection of it. The panther engine, searches a predefined number of directories

to check wheather it contains an unattend.xml or autounattend.xml file. The diffrent directories, are also prioritized which are documented within the unattend.chm file that is accompinied with the WAIK tools (search for panther).

Personally, I store mine in C:\Windows\Panther....

Q6: Does it get rename?

A6: Not to my knowledge...

Q7: Where does it go so when WInPE rebots and teh host boots up it is used and builds with those settings?

A7: Once the sysprep phase has ended, the image is saved onto a network server. The image would then contain the actual files contained on the "base" machine (if not skipped by a .wim script) which MDT defaults to. Once you apply the image that you saved to the network location by for example WDS to the target machine, the panther engine would start to scan it's predefined order of directories. In my case, it would search for example the root of C:, not finding any unattend.xml file until it hits c:\Windows\Panther. Now, the setup engine would determine, if the .xml is properly formated (xml) and if it contains all the required params. We assume it does....

Q8: I assume it has to be placed somewhere on the host's hard drive. But where? I can't find this information anywhere.

A8: Listed above... however, the .chm files contained within the WAIK tools (search tag "panther" / "setup phase") should prolly provide you with the start documentation for getting on with it...

I strongly recommend the MDT as it can be highly customized for your deployment, and get you on the way pretty fast...

Hope it helps and gg!

Edited by Br4tt3
Link to comment
Share on other sites

Thanks Br4tt3,

I am finding that alot of people are not using any of MS's tools (like the MDT). I've been in contact with MS as well as several other individuals in my situation and the Unattend.xml is simply generated line by line and checked against the WAIK before the code is rolled into production. One company I spoke with is using a generic unattend.xml and is doing a search and replace for strings.

Chris

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...