7

I'm working with Windows Server 2012, Windows Deployment Service (WDS), and Windows Assessment and Deployment Kit (ADK). I created a base unattended.xml file. When I go to edit in an xml editor it's actually a bit annoying since I don't have an xsd.

Basically, I was wondering if there is a schema (xsd) for the unattended.xml file. I know I can easily go to the Microsoft TechNet: Unattended Windows Setup site, but I find two issues with this:

  1. I can't seem to find the attributes available for each node.

    For example... I know that Microsoft-Windows-Setup allows for attributes such as publicKeyToken, language, versionScope, and processorArchitecture just by looking at the default unattended.xml file that I have; but, on the page I do not see these attributes listed... only a summary and what nodes can be placed within this node.

  2. It doesn't increase the speed or make it easy to edit the xml file in my xml editor.

Again, just looking for where I can actually find the xsd whether it is a Microsoft download or if it is in a specific folder location from a Microsoft download or even someone's sky drive account if it had to have been hand-made.

John Gardeniers
  • 27,262
  • 12
  • 53
  • 108
myermian
  • 131
  • 1
  • 8

3 Answers3

3

According to this stackoverflow question (link), you can generate it

xsd.exe unattend.xml

I did some keyword search for all xsd files in MDT, following file match publicKeyToken, language, and processorArchitecture (but no versionScope)

C:\Program Files\Microsoft Deployment Toolkit\Templates\Packages.xsd

It seems I am running to dead end even from MS documentation. http://schemas.microsoft.com/unattend gives error page(it does contain other MS schema). Tried using resource viewer on some DLLs but didn't find any xsd resources. I am starting to suspect that the unattend schema is stored as some kind of data structure within MS tools.

I did use the xsd.exe against Microsoft Deployment Toolkit\Templates\Unattend_Core_x64.xml and produced the following xsd. Maybe that can help with your xml editor. (This does not replace an official schema.)

Unattend_Core_x64.xsd

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="unattend" targetNamespace="urn:schemas-microsoft-com:unattend" xmlns:mstns="urn:schemas-microsoft-com:unattend" xmlns="urn:schemas-microsoft-com:unattend" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified" xmlns:app1="http://schemas.microsoft.com/WMIConfig/2002/State">
  <xs:import namespace="http://schemas.microsoft.com/WMIConfig/2002/State" schemaLocation="Unattend_Core_x64_app1.xsd" />
  <xs:element name="unattend" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="settings">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="component" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="ComputerName" type="xs:string" minOccurs="0" msdata:Ordinal="1" />
                    <xs:element name="ProductKey" type="xs:string" minOccurs="0" msdata:Ordinal="2" />
                    <xs:element name="RegisteredOrganization" type="xs:string" minOccurs="0" msdata:Ordinal="3" />
                    <xs:element name="RegisteredOwner" type="xs:string" minOccurs="0" msdata:Ordinal="4" />
                    <xs:element name="DoNotCleanTaskBar" type="xs:string" minOccurs="0" msdata:Ordinal="5" />
                    <xs:element name="TimeZone" type="xs:string" minOccurs="0" msdata:Ordinal="6" />
                    <xs:element name="InputLocale" type="xs:string" minOccurs="0" msdata:Ordinal="7" />
                    <xs:element name="SystemLocale" type="xs:string" minOccurs="0" msdata:Ordinal="8" />
                    <xs:element name="UILanguage" type="xs:string" minOccurs="0" msdata:Ordinal="9" />
                    <xs:element name="UserLocale" type="xs:string" minOccurs="0" msdata:Ordinal="10" />
                    <xs:element name="UserAccounts" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="AdministratorPassword" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="Value" type="xs:string" minOccurs="0" />
                                <xs:element name="PlainText" type="xs:string" minOccurs="0" />
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="AutoLogon" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="Enabled" type="xs:string" minOccurs="0" />
                          <xs:element name="Username" type="xs:string" minOccurs="0" />
                          <xs:element name="Domain" type="xs:string" minOccurs="0" />
                          <xs:element name="LogonCount" type="xs:string" minOccurs="0" />
                          <xs:element name="Password" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="Value" type="xs:string" minOccurs="0" />
                                <xs:element name="PlainText" type="xs:string" minOccurs="0" />
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="RunSynchronous" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="RunSynchronousCommand" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="Description" type="xs:string" minOccurs="0" msdata:Ordinal="0" />
                                <xs:element name="Order" type="xs:string" minOccurs="0" msdata:Ordinal="1" />
                                <xs:element name="Path" type="xs:string" minOccurs="0" msdata:Ordinal="2" />
                              </xs:sequence>
                              <xs:attribute ref="app1:action" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="Identification" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="JoinDomain" type="xs:string" minOccurs="0" />
                          <xs:element name="JoinWorkgroup" type="xs:string" minOccurs="0" />
                          <xs:element name="MachineObjectOU" type="xs:string" minOccurs="0" />
                          <xs:element name="Credentials" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="Username" type="xs:string" minOccurs="0" />
                                <xs:element name="Domain" type="xs:string" minOccurs="0" />
                                <xs:element name="Password" type="xs:string" minOccurs="0" />
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="SetupUILanguage" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="UILanguage" type="xs:string" minOccurs="0" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="ImageInstall" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="OSImage" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="WillShowUI" type="xs:string" minOccurs="0" />
                                <xs:element name="InstallTo" minOccurs="0" maxOccurs="unbounded">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="DiskID" type="xs:string" minOccurs="0" />
                                      <xs:element name="PartitionID" type="xs:string" minOccurs="0" />
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="InstallFrom" minOccurs="0" maxOccurs="unbounded">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="Path" type="xs:string" minOccurs="0" />
                                      <xs:element name="MetaData" minOccurs="0" maxOccurs="unbounded">
                                        <xs:complexType>
                                          <xs:sequence>
                                            <xs:element name="Key" type="xs:string" minOccurs="0" />
                                            <xs:element name="Value" type="xs:string" minOccurs="0" />
                                          </xs:sequence>
                                        </xs:complexType>
                                      </xs:element>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="Display" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="ColorDepth" type="xs:string" minOccurs="0" />
                          <xs:element name="HorizontalResolution" type="xs:string" minOccurs="0" />
                          <xs:element name="RefreshRate" type="xs:string" minOccurs="0" />
                          <xs:element name="VerticalResolution" type="xs:string" minOccurs="0" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="FirstLogonCommands" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="SynchronousCommand" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="CommandLine" type="xs:string" minOccurs="0" msdata:Ordinal="0" />
                                <xs:element name="Description" type="xs:string" minOccurs="0" msdata:Ordinal="1" />
                                <xs:element name="Order" type="xs:string" minOccurs="0" msdata:Ordinal="2" />
                              </xs:sequence>
                              <xs:attribute ref="app1:action" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="OOBE" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="HideEULAPage" type="xs:string" minOccurs="0" />
                          <xs:element name="NetworkLocation" type="xs:string" minOccurs="0" />
                          <xs:element name="ProtectYourPC" type="xs:string" minOccurs="0" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="ComplianceCheck" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="DisplayReport" type="xs:string" minOccurs="0" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="UserData" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="AcceptEula" type="xs:string" minOccurs="0" />
                          <xs:element name="ProductKey" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="Key" type="xs:string" minOccurs="0" />
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="DriverPaths" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="PathAndCredentials" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="Path" type="xs:string" minOccurs="0" msdata:Ordinal="0" />
                              </xs:sequence>
                              <xs:attribute ref="app1:keyValue" />
                              <xs:attribute ref="app1:action" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="name" form="unqualified" type="xs:string" />
                  <xs:attribute name="processorArchitecture" form="unqualified" type="xs:string" />
                  <xs:attribute name="publicKeyToken" form="unqualified" type="xs:string" />
                  <xs:attribute name="language" form="unqualified" type="xs:string" />
                  <xs:attribute name="versionScope" form="unqualified" type="xs:string" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="pass" form="unqualified" type="xs:string" />
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>
John Siu
  • 3,577
  • 2
  • 15
  • 23
0

There's a powershell script for validation:

https://gist.github.com/davidwallis3101/48454cb6c17c988de43b5ea17089ea6f

Inside it I found a description of where the schema is and how to extract it at the following URL:

https://schneegans.de/windows/unattend-schema/

It is base64 encoded in some component of the ADK:

The file name is microsoft.componentstudio.componentplatforminterface.dll and the resource path is: Microsoft.ComponentStudio.ComponentPlatformInterface.MyResources.resources

Since it's just named MyResources I suppose this was built under some time pressure and maybe that's why noone had the chance of releasing it. I suppose it will need someone with good friends at Microsoft to be able to get it released in a more accessible manner.

Florian Heigl
  • 1,440
  • 12
  • 19
0

If you've got WAIK 8 installed then go to the directory that you've installed it to. Locate the file Microsoft.ComponentStudio.ComponentPlatformInterface.dll and open it in your favourite decompiler to see how Microsoft do it.

The main method to look at is the Validate() method and when you look at it it goes through the different stages (passes) and validates them one-by-one. ValidateXml() is useful and worth a look too, as is DoLoad()

It's basically taking some of the XSD files that are installed with WAIK and using them:
"C:\Program Files\Microsoft Deployment Toolkit\Templates\Drivers.xsd"
"C:\Program Files\Microsoft Deployment Toolkit\Templates\Groups.xsd"
"C:\Program Files\Microsoft Deployment Toolkit\Templates\InstallerComponents.xsd"
"C:\Program Files\Microsoft Deployment Toolkit\Templates\LinkedDeploymentShares.xsd"
"C:\Program Files\Microsoft Deployment Toolkit\Templates\Medias.xsd"
"C:\Program Files\Microsoft Deployment Toolkit\Templates\OperatingSystems.xsd"
"C:\Program Files\Microsoft Deployment Toolkit\Templates\Packages.xsd"
"C:\Program Files\Microsoft Deployment Toolkit\Templates\SelectionProfiles.xsd"
"C:\Program Files\Microsoft Deployment Toolkit\Templates\TaskSequences.xsd"
"C:\Program Files\Microsoft Deployment Toolkit\Templates\Applications.xsd"

noonand
  • 287
  • 1
  • 7
  • 25