8

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.

4 Answers 4

3
+50

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>
6
  • I try to locate AIK for 2012 but the lastest I can find is for 7.
    – John Siu
    Jan 13, 2013 at 8:11
  • 1
    Generating a schema from an xml will result in something very different than having the real schema file. :(
    – myermian
    Jan 13, 2013 at 13:44
  • I understand. I am still digging for the real thing.
    – John Siu
    Jan 13, 2013 at 20:51
  • Updated my answer. Basically I am running into dead end for an official xsd.
    – John Siu
    Jan 14, 2013 at 2:28
  • I've awarded you the bounty for being the closest to the answer I need, but not the checkmark because I'm still going to leave this open for an official xsd.
    – myermian
    Jan 17, 2013 at 14:48
1

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.

1

Based on this (found in this answer, I have created the following PowerShell script. I had to update some paths in the ildasm command (e.g. all files are under ${env:ProgramFiles(x86)} or that the microsoft.componentstudio.componentplatforminterface.dll file is now moved up into an architecture folder.

# Extract unattend XSD from Windows ADK


# Define where the XSD schema should be saved, incl the filename
$out = "$env:USERPROFILE\unattend_win_10.xsd"

# Download Windows ADK 10.1.25398.1
Write-Output 'Downloading Windows ADK ...'

$adksetup = Start-BitsTransfer 'https://go.microsoft.com/fwlink/?linkid=2243390' -Destination "$env:TEMP/adksetup.exe"

switch ($adksetup.JobState) {
  'Transferred' {
    Complete-BitsTransfer -BitsJob $adksetup
    Write-Output 'Windows ADK downloaded.'
    break
  }

  'Error' {
    throw 'Error downloading Windows ADK.'
  }
}

# Download .NET Framework 4.7.2 Developer Pack
Write-Output 'Downloading .NET Framework 4.7.2 Developer Pack ...'

$dotnet = Start-BitsTransfer 'https://go.microsoft.com/fwlink/?linkid=2243390' -Destination "$env:TEMP/dotnet_4.7.2_dev_pack.exe"

switch ($dotnet.JobState) {
  'Transferred' {
    Complete-BitsTransfer -BitsJob $dotnet
    Write-Output '.NET Framework 4.7.2 Developer Pack downloaded.'
    break
  }

  'Error' {
    throw 'Error downloading .NET Framework 4.7.2 Developer Pack.'
  }
}

# Install Deployment Tools feature from Windows ADK
Write-Output 'Installing Windows ADK ...'
Start-Process -Wait "$env:TEMP\adksetup.exe" -ArgumentList '/q /features OptionId.DeploymentTools /norestart /ceip off'
Write-Output 'Windows ADK installed.'

# Install .NET Framework 4.7.2 Developer Pack
Write-Output 'Installing .NET Framework 4.7.2 Developer Pack ...'
Start-Process -Wait "$env:TEMP\dotnet_4.7.2_dev_pack.exe"
Write-Output '.NET Framework 4.7.2 Developer Pack installed.'

if (!(Test-Path "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\ildasm.exe" -PathType Leaf)) {
  throw 'Could not find `ildasm.exe`.'
}

if (!(Test-Path "${env:ProgramFiles(x86)}\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\WSIM\amd64\microsoft.componentstudio.componentplatforminterface.dll" -PathType Leaf)) {
  throw 'Could not find `microsoft.componentstudio.componentplatforminterface.dll`.'
}

# Extract the resources embedded in `microsoft.componentstudio.componentplatforminterface.dll`
Write-Output 'Extracting the XSD schema embedded in `microsoft.componentstudio.componentplatforminterface.dll`'
& "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\ildasm.exe" "${env:ProgramFiles(x86)}\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\WSIM\amd64\microsoft.componentstudio.componentplatforminterface.dll" /Output="$env:TEMP\out.il"

if (!(Test-Path "$env:TEMP\Microsoft.ComponentStudio.ComponentPlatformInterface.MyResources.resources" -PathType Leaf)) {
  throw 'Could not find `Microsoft.ComponentStudio.ComponentPlatformInterface.MyResources.resources`.'
}

# Get content from the input file
$fileContent = Get-Content -Path "$env:TEMP\Microsoft.ComponentStudio.ComponentPlatformInterface.MyResources.resources" -Raw

# Regular expression (Regex) of the given start and end patterns
$pattern = '(?is)({0}.*?{1})' -f [regex]::Escape('<?xml version='), [regex]::Escape('</xsd:schema>')

# Perform the Regex operation and save it to file
[regex]::Match($fileContent, $pattern).Groups[1].Value | Set-Content -Path "$out"

if (!(Test-Path "$out" -PathType Leaf)) {
  throw "Could not find `$out`."
}

Write-Output 'The XSD schema extracted.'

# Clean up
Remove-Item "$env:TEMP\Microsoft.ComponentStudio.ComponentPlatformInterface.DistributionShareResources.resources", "$env:TEMP\Microsoft.ComponentStudio.ComponentPlatformInterface.MyResources.resources", "$env:TEMP\adksetup.exe", "$env:TEMP\dotnet_4.7.2_dev_pack.exe", "$env:TEMP\out.il", "$env:TEMP\out.res"
2
  • I still miss the schema for <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> (it is used several times in the unattend file). WebStorm cannot find it and says the URI is not registered. I wish I could find the schema for that State too. Jan 1 at 14:47
  • 1
    great work sharing this, i wish i knew i'll remember when i work on that topic again Jan 10 at 20:40
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"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .