Joshua Cooper
, ,
No Comments


Last week I had finally had enough of it. You know that feeling you get when you have been running the same installation of Windows for too long? Even if the system isn’t slow, it still feels bloated and dirty.. you know? I have a 32GB SSD installed, and it had everything on it. When I first installed Windows 10 I found out the hard way that half the system would break if you moved around directories and created junctions. That is how I used to move my Users and Program Files to other drives, I even made batch scripts to help the process. I had a script to robocopy the directories and then put down junctions to their new locations. I had a couple other setup scripts I ran as well. None of them were any good to me now though, which was a shame because I just made them before getting Windows 10. I used them a total of 1 times.

So, I thought to myself, how will I make a Windows 10 clean install easier? I recalled, from my time in college learning IT, that I could create an answer file to help automate deployments.

It had been a while and a lot had changed since Windows Vista. So I started doing a bit of research. I wasn’t sure where to place the file after I made it, so I looked that up first since it is one of the most important aspects. Simple, it goes on the root of the installation media; all I had to do was put the file on the root of my USB drive. Though I would prefer if I didn’t need to boot the USB as UEFI, because then I could multiboot it along with the rest of most of my other OS images.

You don’t really need software to create an answer file, but the “Windows System Image Manager” can be quite helpful. It also won’t save you from installation errors, which I didn’t think would be the case. It basically just checks the syntax of your file, it doesn’t truly “validate” the answer file. I also used Windows Answer File Generator to help discover some of the necessary semantics to accomplish my goals.

The final resource, which I found most helpful was the documentation Microsoft provides here. I used the software to validate my files as much as I could, and I used the generator to find useful common configuration tags, and google for finding the less common tags. Lastly, I used the documentation to verify which tags are nested where.

Somewhere around the 15th iteration, I ended up with the file below. There were many failed installs, and even more often errors preventing the installation from proceeding altogether. I doubt this configuration will help anyone but me, but there it is just incase. Also a few important tidbits on how to go about making a custom one in the info above.

<!-- Wipe Disk - Autounattend.xml -->
<!-- 
In other words, this answer file does not wipe the system drive.
Instead it will only format the partitions to be used by windows.
Disk 0: p1, p2; (System Reserved, C Drive)
Disk 1: p1; (U Drive ie. C:\Users -> U:\Users) 
-->
<?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">
			<UserData>
				<ProductKey>
					<WillShowUI>OnError</WillShowUI>
					<Key>12345-23451-34512-45123-51234</Key>
				</ProductKey>
				<AcceptEula>true</AcceptEula>
			</UserData>
			<DiskConfiguration>
				<WillShowUI>OnError</WillShowUI>
				<Disk wcm:action="add">
					<DiskID>0</DiskID>
					<WillWipeDisk>true</WillWipeDisk>
					<CreatePartitions>
						<CreatePartition wcm:action="add">
							<Order>1</Order>
							<Type>EFI</Type>
							<Size>100</Size>
						</CreatePartition>
						<CreatePartition wcm:action="add">
							<Order>2</Order>
							<Type>Primary</Type>
							<size>20000</size>
						</CreatePartition>
					</CreatePartitions>
					<ModifyPartitions>
						<ModifyPartition wcm:action="add">
							<Order>1</Order>
							<PartitionID>1</PartitionID>
							<Format>FAT32</Format>
							<Label>System</Label>
						</ModifyPartition>
						<ModifyPartition wcm:action="add">
							<Order>2</Order>
							<PartitionID>2</PartitionID>
							<Format>NTFS</Format>
							<Letter>C</Letter>
							<Label>Windows10</Label>
						</ModifyPartition>
					</ModifyPartitions>
				</Disk>
				<Disk wcm:action="add">
					<DiskID>1</DiskID>
					<WillWipeDisk>true</WillWipeDisk>
					<CreatePartitions>
						<CreatePartition wcm:action="add">
							<Size>62000</Size>
							<Type>Primary</Type>
							<Order>1</Order>
						</CreatePartition>
					</CreatePartitions>
					<ModifyPartitions>
						<ModifyPartition wcm:action="add">
							<Extend>false</Extend>
							<Format>NTFS</Format>
							<Label>Users</Label>
							<Letter>U</Letter>
							<Order>1</Order>
							<PartitionID>1</PartitionID>
						</ModifyPartition>
					</ModifyPartitions>
				</Disk>
			</DiskConfiguration>
			<ImageInstall>
				<OSImage>
					<WillShowUI>OnError</WillShowUI>
					<InstallTo>
						<DiskID>0</DiskID>
						<PartitionID>2</PartitionID>
					</InstallTo>
				</OSImage>
			</ImageInstall>
		</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">
			<FolderLocations>
				<ProfilesDirectory>U:\Users</ProfilesDirectory>
			</FolderLocations>
			<UserAccounts>
				<LocalAccounts>
					<LocalAccount wcm:action="add">
						<Password>
							<Value>*********</Value>
							<PlainText>true</PlainText>
						</Password>
						<Name>localadmin</Name>
						<DisplayName>localadmin</DisplayName>
						<Group>Administrators</Group>
					</LocalAccount>
				</LocalAccounts>
			</UserAccounts>
		</component>
	</settings>
	<cpi:offlineImage cpi:source="wim:E:\sources\install.wim#Windows 10 Pro" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>