# Specialize DriverPacks

{% hint style="warning" %}
Wait for the next update to the OSD Module before trying this out as these functions have not been released yet
{% endhint %}

OSDCloud applies HP and Lenovo DriverPacks in the Specialize Phase of Windows Setup.  The reason this is done is because HP and Lenovo Driver Packs are in 32-Bit EXE format, so they cannot be executed and expanded in WinPE x64.  This page will detail how OSDCloud handles this

## Save-MyDriverPack (WinPE)

When OSDCloud encounters an EXE Driver Pack (HP and Lenovo) a warning is displayed in WinPE that it is unable to be expanded.  **`Deploy-OSDCloud.ps1`** addresses this by executing the function **`Add-StagedDriverPack.specialize`**

![](https://344220114-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVSV22dcsjKDdOxDA6n%2F-MWrgwb6Jkek_gFXaXKE%2F-MWrhcIjJGysXx47BvZu%2Fimage.png?alt=media\&token=f07c0fed-6627-4bf7-bdb0-239bb81252c4)

![](https://344220114-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVSV22dcsjKDdOxDA6n%2F-MWrgwb6Jkek_gFXaXKE%2F-MWricw4H06k1JcmAWwj%2Fimage.png?alt=media\&token=b26af7b9-f91e-4756-b088-bdbff0fbcbaf)

## Add-StagedDriverPack.specialize

This function will create an Unattend file in the following location

```
C:\Windows\Panther\Expand-StagedDriverPack.xml
```

The contents of the Unattend are to simply execute the function Expand-StagedDriverPack

```
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="specialize">
        <component name="Microsoft-Windows-Deployment" 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">
            <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <Description>Expand-StagedDriverPack</Description>
                    <Path>Powershell -ExecutionPolicy Bypass -Command Expand-StagedDriverPack</Path>
                </RunSynchronousCommand>
            </RunSynchronous>
        </component>
    </settings>
</unattend>
```

To ensure that this Unattend file is run, the following Registry entry is made in the Offline OS

```
PS C:\> (Get-ItemProperty -Path HKLM:\SYSTEM\Setup).UnattendFile
C:\Windows\Panther\Expand-StagedDriverPack.xml
```

## Answer File Search Order

By doing this method, it ensures that if you have an Unattend.xml file placed in C:\Windows\Panther, it will not interfere with the Specialize pass, nor will an existing Unattend.xml file be overwritten.  Additionally, the Registry method is the first Answer File that is processed if it exists

![](https://344220114-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVSV22dcsjKDdOxDA6n%2F-MWrGZCleGcfusdlPE4J%2F-MWrJytv6K-bZkYwCvOJ%2Fimage.png?alt=media\&token=c10e3e56-e71e-42a4-8e71-df97f20c909d)

For more details about the Answer File settings, see the following link

{% embed url="<https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-automation-overview#implicit-answer-file-search-order>" %}

## Expand-StagedDriverPack

Once the Specialize phase has started, the Answer File will expand any DriverPacks and apply the drivers using pnpunattend.exe.  A quick look at the code will do a better job of explaining how this needs to work

![](https://344220114-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVSV22dcsjKDdOxDA6n%2F-MWrkKg1aZRWTpY4ewkq%2F-MWrkm54mDk6au4tu56z%2Fimage.png?alt=media\&token=9a0350a7-9308-43db-b895-73b5de0961da)

And here is a video of how the process looks

{% embed url="<https://youtu.be/Fbb_hoYQph4>" %}

## Next Steps

If you think this applies only to OSDCloud, you are missing the big picture.  This process opens the way to replacing Out-of-box-Drivers in MDT with DriverPacks.  More details on this to come shortly
