Skip to content

Instantly share code, notes, and snippets.

@chrisoldwood
Last active November 25, 2019 15:10
Show Gist options
  • Save chrisoldwood/39e454f8bbce5858d8d634d12f500082 to your computer and use it in GitHub Desktop.
Save chrisoldwood/39e454f8bbce5858d8d634d12f500082 to your computer and use it in GitHub Desktop.
Example Oz configuration files for creating a Windows 10 VM on QEMU/KVM/libvirt with oz-install.
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DiskConfiguration>
<Disk>
<CreatePartitions>
<CreatePartition>
<Order>1</Order>
<Size>1</Size>
<Type>Primary</Type>
</CreatePartition>
</CreatePartitions>
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<ModifyPartitions>
<ModifyPartition>
<Active>true</Active>
<Extend>true</Extend>
<Format>NTFS</Format>
<Label>C drive</Label>
<Letter>C</Letter>
<Order>1</Order>
<PartitionID>1</PartitionID>
</ModifyPartition>
</ModifyPartitions>
</Disk>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>1</PartitionID>
</InstallTo>
</OSImage>
</ImageInstall>
<UserData>
<AcceptEula>true</AcceptEula>
<FullName>Oz-Admin</FullName>
<Organization></Organization>
<ProductKey>
<Key>W269N-WFGWX-YVC9B-4J6C9-T83GX</Key>
</ProductKey>
</UserData>
</component>
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-US</UserLocale>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>oz-admin</Value>
<PlainText>true</PlainText>
</Password>
<Description></Description>
<DisplayName>Oz Admin</DisplayName>
<Group>Administrators</Group>
<Name>Oz-Admin</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<AutoLogon>
<Password>
<Value>oz-admin</Value>
<PlainText>true</PlainText>
</Password>
<Enabled>true</Enabled>
<Username>Oz-Admin</Username>
</AutoLogon>
<OOBE>
<NetworkLocation>Work</NetworkLocation>
<HideEULAPage>true</HideEULAPage>
<ProtectYourPC>3</ProtectYourPC>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<Description>Turn Off Network Selection pop-up</Description>
<CommandLine>cmd /c reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>2</Order>
<Description>Shutting down Windows</Description>
<CommandLine>cmd /C shutdown /s /t 0</CommandLine>
</SynchronousCommand>
</FirstLogonCommands>
</component>
</settings>
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName>Windows10-OZ</ComputerName>
<ProductKey>W269N-WFGWX-YVC9B-4J6C9-T83GX</ProductKey>
</component>
</settings>
</unattend>
<template>
<name>windows-10</name>
<os>
<name>Windows</name>
<version>10</version>
<arch>x86_64</arch>
<install type='iso'>
<iso>file://Win10_1909_English_x64.iso</iso>
</install>
<key>W269N-WFGWX-YVC9B-4J6C9-T83GX</key>
</os>
<disk>
<size>15</size>
</disk>
</template>
@chrisoldwood
Copy link
Author

Example of how to create a Windows 10 VM on QMEU/KVM/libvirt using the 0z tool. The .iso and product key are for the Windows 10 Professional evaluation edition (v1909 at the time of writing) and are both publicly accessible.

oz-install -d2 -p windows10.tdl -a windows10.auto.xml -x windows10.libvirt.xml
virsh define windows10.libvirt.xml
virsh start windows-10

Note: the current Windows 10 0z template is slightly broken which is why we're overriding it on the command line here, see issue #268 for further details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment