Inject the Drivers during Task Sequence execution via Auto IT Script

Hello Friends, Here is another way to inject the drivers is based on the hardware mode. This time we are using the AutoIT script solution to create the script and us in the Task Sequence.

In order to achieve this method follow the below steps. 

1. Create the folder structure as below.

        a. Vendor\Hardware model\

2. Download the AutoIT script editor here and install it on your machine.

3. Write the below script in the "SciTE Script Editor" located  at C:\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3

Inject the Drivers during Task Sequence execution via Auto IT Script


4. Save the file as InjectDrivers.au3

5. Open "Compile Script to .exe (x64)" from C:\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3

6. Compile the script and save the InjectDrivers.exe into the “Vendor\Hardware model\” folder.

7. Download the specific hardware model driver package from the vendor website and extract the cab files.

8. Archieve/Zip all the extracted drivers into one single folder called "Drivers.zip".

9. Copy DISM folder from ADK installed machine and place into the "Vendor\Hardware model\" path of DISM-(C:\Program Files (x86)\Windows Kits\<version>\Assessment and Deployment Kit\Deployment Tools\10\DISM)

10. Download the 7za.exe and place it(7za.dll, 7za.exe, and 7zxa.dll) into the "Vendor\Hardware model\".


AutoItSetOption("TrayIconHide", 1)

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

Global $OSDrive

Global $DriversArchive, $DriversExtracted

Global $TSEnvironment, $SMSTSLogPath

$TSEnvironment = ObjCreate("Microsoft.SMS.TSEnvironment")

$SMSTSLogPath = $TSEnvironment.Value("_SMSTSLogPath")

;Set $OSDrive

$OSDrive = "C:"

;Set the folder where Driver will be extracted

$DriversExtracted = $OSDrive & "\Windows\Temp\Drivers"

DirCreate($DriversExtracted)

$DriversArchive = @ScriptDir & "\Drivers.zip"

;Extract the Drivers

DirCreate(@ScriptDir & "\Drivers")

RunWait(Chr(34) & @ScriptDir & "\Files\7za.exe" & Chr(34) & " x " & Chr(34) & $DriversArchive & Chr(34) & " -y -o" & Chr(34) & $DriversExtracted & Chr(34), @ScriptDir & "\Files", @SW_HIDE)

;Load the DISM Drivers

;RunWait(Chr(34) & @ScriptDir & "\Files\DISM\wimmountadksetupamd64.exe" & Chr(34) & " /Install /q", @ScriptDir & "\Files\DISM", @SW_HIDE)

;Run DISM

RunWait(Chr(34) & @ScriptDir & "\Files\DISM\DISM.exe" & Chr(34) & " /Image:" & $OSDrive & "\" & " /Add-Driver /Driver:" & $DriversExtracted & "\" & " /Recurse /LogPath:" & $SMSTSLogPath & "\DISM_DriverInjection.log", @ScriptDir & "\Files\DISM", @SW_HIDE)

;Cleanup Drivers

FileDelete(@ScriptDir & "\Driver.7z")

FileDelete(@ScriptDir & "\Driver.zip")

DirRemove($DriversExtracted, 1)

Create the normal SCCM package and distribute it on required DPs and use and use in the Task sequence as shown in the below image. While the package is executing during the Task Sequence execution, the lo file will create in the CCM\logs folder named "DISM_DriverInjection.log"

Share how much time you saved to build one machine and also share your valuable comments on this solution.

No comments:

Post a Comment

Leave your valuable words here for improve better.