Answer file / autounattend.xml DiskID changes after loading drivers


  1. Posts : 3
    W10/Ubuntu
       #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">".

    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>
    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.

    To be able to use "%configsetroot%" an extra element needs to be called in the autounattend.xml:
    Code:
    <UseConfigurationSet>true</UseConfigurationSet>
    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:
    <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.
      My Computer


  2. Posts : 1
    Windows 10
       #2

    I've come across this post and I'm facing the same issue with the Disk ID changing when loading missing storage drivers. Did you ever find a solution?
      My Computer


  3. Posts : 3
    W10/Ubuntu
    Thread Starter
       #3

    drkmccy said:
    I've come across this post and I'm facing the same issue with the Disk ID changing when loading missing storage drivers. Did you ever find a solution?
    I've not found a solution to automate it. The way I currently do it is that I have two answer files, one with and one without driver loading which have the correct disk ID for either choice. I use a batch script to switch them around, but it is still a manual process. I start with the regular answer file, if it doesn't work and needs drivers I add them and switch the answer file too.
      My Computer


  4. Posts : 776
    Windows 7
       #4

    The real answer is to integrate the required disk controller drivers into boot.wim, instead of dynamically loading them from a search folder. Otherwise you will never fix the "out of order" problem.

    When the driver set is integrated, the system disk will take correct precedence as DiskId 0 instead of the USB/DVD.

    1. Find the Intel RST (?) driver set for this system. Extract drivers to a local folder.
    2. DISM mount the boot.wim, from the ISO.
    3. DISM /Add-Driver the extracted driver folder.
    4. DISM unmount and commit.
    5. Repeat steps for the install.wim, from the ISO.

    Add and Remove Driver packages to an offline Windows Image
      My Computer


  5. Posts : 3
    W10/Ubuntu
    Thread Starter
       #5

    garlin said:
    The real answer is to integrate the required disk controller drivers into boot.wim, instead of dynamically loading them from a search folder. Otherwise you will never fix the "out of order" problem.

    When the driver set is integrated, the system disk will take correct precedence as DiskId 0 instead of the USB/DVD.

    1. Find the Intel RST (?) driver set for this system. Extract drivers to a local folder.
    2. DISM mount the boot.wim, from the ISO.
    3. DISM /Add-Driver the extracted driver folder.
    4. DISM unmount and commit.
    5. Repeat steps for the install.wim, from the ISO.

    Add and Remove Driver packages to an offline Windows Image
    You are absolutely correct. For my use case that wasn't the preferred solution though. But if you are using the image for a bunch of similar devices this is the way to go.
      My Computer


  6. Posts : 776
    Windows 7
       #6

    Any other workaround requires scripting your own WinPE pre-install sequence.

    The script would check diskpart (or wmic) for the system drive's ID, and then call sources\setup /unattended:[path]\driveis0.xml or driveis1.xml. Your problem isn't really the disk layout, but that Unattended mode only has one way to select the install disk, which is the <InstallTo> tag inside autounattend.xml.

    There is no way to pass that argument outside of the answer file. Of course, you could run DISM /Apply-Image and extract the install.wim to the system disk. But now you're getting further away from a simple solution. That's why you fix the root of the problem and integrate the boot drivers for your controllers.
      My Computer


  7. Posts : 295
    Windows 10 Pro
       #7

    I use NTLite myself, but is there no way to wild card this: <DiskID>0</DiskID>?

    So maybe: <DiskID>*</DiskID>
      My Computer


  8. Posts : 776
    Windows 7
       #8

    Unattended mode doesn't support wildcards, except for ComputerName. Even NTLite can't fix this problem for you.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 12:45.
Find Us




Windows 10 Forums