How to specify network configuration in an unattend.xml file


I recently faced a problem for deploying Windows Server 2008 servers using WAIK when specifying the gateway in the IP V4 networking configuration. This article may avoid you the time of searching and hopefully finding the solution to the problem of what seems a bug in WAIK.


If you want to specify only an IP address in an unattend.xml file, it is straightforward : use WAIK to automatically generate a unattend.xml file and it works.


But if you want to add a gateway, you get in trouble using WAIK : even if you manage to find the syntax to use, the generated xml file doesn’t work, and looking at the help and examples in the help files is useless : examples for this specific case were surely never tested, they just do not work.


The workaround is to modify the unattend.xml file which was badly generated by WAIK by moving the line containing the identification of the networking card up to the correct position.


You can do this with Notepad.


The file below is correct after having been manually modified :


            <Interfaces>


                <Interface wcm:action=”add”>


                    <Ipv4Settings>


                        <DhcpEnabled>false</DhcpEnabled>


                    </Ipv4Settings>


                    <Identifier>Local Area Connection</Identifier>


                    <UnicastIpAddresses>


                        <IpAddress wcm:action=”add” wcm:keyValue=”1″>10.123.242.51/24</IpAddress>


                    </UnicastIpAddresses>


                    <Routes>


                        <Route wcm:action=”add”>


                            <Identifier>0</Identifier>


                            <Prefix>0.0.0.0/0</Prefix>


                            <Metric>20</Metric>


                            <NextHopAddress>10.123.242.1</NextHopAddress>


                        </Route>


                    </Routes>


                </Interface>


            </Interfaces>


 


You first must move the line identifying the networking card (<Identifier>Local Area Connection</Identifier>) up to the line as in the example above, just below </Ipv4Settings>.


 


Then the syntax for the gateway should respect the following :


·        The line containing the Prefix tag should contain 0.0.0.0/0 as above


·        There must be a line containing the Identifier tag. I have tested it with the values 0 and 1 and it works. It may work with other values but I have lost enough time around this problem, I have not tried other values


·        Of course, there must be a line containing the NextHopAddress tag containing the address of the gateway


·        The line containing the Metric tag may be present as in the example above, or not be present, it works in either case


 


Comments (8)

  1. Anonymous says:

    Well it's 2013 and Microsoft still has not fixed this problem! Clearly nobody must be using static IPs….

  2. Anonymous says:

    Great post.  How on earth did you find the bug with the identifier tag?  Do you know if this has been reported to MS so they fix the WAIK tool?

  3. WoCom (Wouter Bruggeman) says:

    Using unattend.xml on a Windows Server 2012 R2 does not work with Static IP neither. WAIK does not generate valid xml.

  4. WoCom (Wouter Bruggeman) says:

    Using unattend.xml on a Windows Server 2012 R2 does not work with Static IP neither. WAIK does not generate valid xml.

  5. WoCom (Wouter Bruggeman) says:

    Using unattend.xml on a Windows Server 2012 R2 does not work with Static IP neither. WAIK does not generate valid xml.

  6. WoCom (Wouter Bruggeman) says:

    Using unattend.xml on a Windows Server 2012 R2 does not work with Static IP neither. WAIK does not generate valid xml.

  7. observer says:

    This does work on 2012r2. You need to make sure that you’re specifying the proper architecture in the component name. It should be "amd64" not "x86."

  8. KERR says:

    This was a life saver. Thanks! Worked great on 2012 R2. Note that the line
    Local Area Connection

    needs to match the name of the connection in NCPA.CPL.