New
#1
Answer file / autounattend.xml DiskID changes after loading drivers
Hi,
I have a problem I hope someone might be able to help me with. I'm adapting my unattended installations to load certain drivers through the autounattend.xml, mostly AHCI/Disk drivers. The problem I face is that when one such driver is needed, the DiskID changes from 0 to 1 (the installation media being 0) during installation and the unattended setup fails because DiskID 0 is specified as the disk to partition, format and install on. This is probably due to the system disk not being available before the drivers are loaded and when they do load, it gets added to the already known disks (the installation media) resulting in a DiskID of 1.
I would like to find a workaround so I don't need to change the autounattend.xml every time the installation process might need a driver, since on a system that doesn't need the separate driver, the DiskID will always be 0. Possbile solutions I could think of:
- For the installation to prompt which disk to use when the specified ID isn't available or valid
- Always load the largest drive (all systems have only one disk except for the installation media)
- Always ignore the installation media during installation
- Load a custom script that identifies the DiskID and let the autounattend.xml use the output value from that script?
I haven't found a way to solve it though, any help would be great.
Since I couldn't find how to automatically load drivers during unattended setup I'll explain two options here that are tested and work. This is for future reference for anyone who is searching for it.
How to automatically load drivers during unattended Windows 10 installation using answer file (autounattend.xml).
Option one:
Add a folder named "$WinpeDriver$" to the root of the installation media and place the drivers inside this folder. This folder will be scanned for drivers during Windows setup automatically. Make sure the drivers are the extracted drivers from the manufacturer which include the files with .inf extensions, you have to manually extract this with for example 7Zip. You can place these drivers in any subfolder under "$WinpeDriver$".
Microsoft resource:
Using \$WinpeDriver$
$WinpeDrivers$ is an additional folder structure that Setup.exe looks for and if found, is parsed to pull in additional drivers. Setup will recursively parse files and folders under this \$WinpeDriver$ folder looking for *.INF files and attempts to install these discovered drivers into the driverstore.
Folder structure can look something like this on the root of the USB device:
\$WinpeDriver$
└\WiFi
└\Wireless1
└Wireless.INF
└Wireless.SYS
└Wireless.CAT (Needed by operating system)
Note
If you look in the \Windows\Panther\Setupact.log you can see reference to this folder: PnPIBS: Checking for pre-configured driver paths ...
PnPIBS: Checking for pre-configured driver directory C:$WinPEDriver$.
PnPIBS: Checking for pre-configured driver directory D:$WinPEDriver$.
PnPIBS: Checking for pre-configured driver directory E:$WinPEDriver$.
PnPIBS: Checking for pre-configured driver directory X:$WinPEDriver$.
Option two:
It's possible to specify a custom folder to load drivers from by adding this to the autounattend.xml answer file. The code to add is as follows. This is added after "<settings pass="windowsPE">".
The thing to note in this is that "%configsetroot%" is how you specifiy the (USB) installation media as the root path in where there is another folder (in my example named "Drivers") where the actualy drivers are located. The folder structure can be the same as in the first option.Code:<component name="Microsoft-Windows-PnpCustomizationsWinPE" 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"> <DriverPaths> <PathAndCredentials wcm:keyValue="1" wcm:action="add"> <Path>%configsetroot%\Drivers</Path> <Credentials></Credentials> </PathAndCredentials> </DriverPaths> </component>
To be able to use "%configsetroot%" an extra element needs to be called in the autounattend.xml:
Below is an example from my autounattend.xml to see where it's placed. This example is the part where it creates the disk layout for an UEFI installation:Code:<UseConfigurationSet>true</UseConfigurationSet>
Code:<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 wcm:action="add"> <CreatePartitions> <CreatePartition wcm:action="add"> <Order>1</Order> <Size>500</Size> <Type>Primary</Type> </CreatePartition> <CreatePartition wcm:action="add"> <Order>2</Order> <Size>100</Size> <Type>EFI</Type> </CreatePartition> <CreatePartition wcm:action="add"> <Order>3</Order> <Size>16</Size> <Type>MSR</Type> </CreatePartition> <CreatePartition wcm:action="add"> <Extend>true</Extend> <Order>4</Order> <Type>Primary</Type> </CreatePartition> </CreatePartitions> <ModifyPartitions> <ModifyPartition wcm:action="add"> <Format>NTFS</Format> <Label>WinRE</Label> <Order>1</Order> <PartitionID>1</PartitionID> <TypeID>DE94BBA4-06D1-4D40-A16A-BFD50179D6AC</TypeID> </ModifyPartition> <ModifyPartition wcm:action="add"> <Format>FAT32</Format> <Label>System</Label> <Order>2</Order> <PartitionID>2</PartitionID> </ModifyPartition> <ModifyPartition wcm:action="add"> <Order>3</Order> <PartitionID>3</PartitionID> </ModifyPartition> <ModifyPartition wcm:action="add"> <Format>NTFS</Format> <Label>Windows</Label> <Letter>C</Letter> <Order>4</Order> <PartitionID>4</PartitionID> </ModifyPartition> </ModifyPartitions> <DiskID>0</DiskID> <WillWipeDisk>true</WillWipeDisk> </Disk> </DiskConfiguration> <ImageInstall> <OSImage> <WillShowUI>OnError</WillShowUI> <InstallTo> <DiskID>0</DiskID> <PartitionID>4</PartitionID> </InstallTo> </OSImage> </ImageInstall> <UserData> <ProductKey> <Key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</Key> <WillShowUI>OnError</WillShowUI> </ProductKey> <AcceptEula>true</AcceptEula> </UserData> <UseConfigurationSet>true</UseConfigurationSet> </component>
Microsoft references:
https://docs.microsoft.com/en-us/win...0answer%20file.
https://docs.microsoft.com/en-us/tro...er-dollar-sign
https://docs.microsoft.com/en-us/win...nfigurationset
Last edited by Juun89; 04 May 2021 at 04:36.