Link

To add a PNP driver from within an MSI do the following. Many thanks to the University of Edinburgh Desktop Services Team for originally posting this information.

**Note this will install the driver silently ONLY in the case where the driver is a "signed" driver. Unsigned drivers will require user intervention and possibly admin access to complete the install of the hardware

1. Create a folder and add the driver files to this folder.

2. In the Execute Deferred section sequence create an If Statement custom action after the InstallFiles action. Make the execution of this action only apply on install by giving it the condition "NOT Installed"

3. To this If Statement add a "Call Custom DLL From Destination" custom action with the settings:

Custom Action Name: SETUPADDTOSOURCELISTA

DLL File: [SystemFolder]setupapi.dll

Function Name: SetupAddToSourceListA

Parameter: dword, Constant, 00000100

Parameter: string pointer, Constant,[Path to driver.inf file]. (Don't enclose paths in double quotes)

Return Value Type: dword

Return Property: DLLRETURN (Pre creating a property has more consistent results)

4. Add a second "Call Custom DLL From Destination" custom action within the same If\End statement with the settings:

Custom Action Name: SETUPCOPYOEMINF

DLL File: [SystemFolder]setupapi.dll

Function Name: SetupCopyOEMInfA

Parameter: string pointer, Constant, ,[Path to driver.inf file](Don't enclose paths in double quotes)

Parameter: long, Constant, NULL

Parameter: dword, Constant, 1

Parameter: long, Constant, NULL

Parameter: long, Constant, NULL

Parameter: dword, Constant, 0

Parameter: long, Constant, NULL

Parameter: long, Constant, NULL

Return Value Type: dword

Return Property: DLLRETURN

Done!

That is the install taken care of, now the uninstall...

1. In the Execute Deferred section sequence an If Statement custom action prior to the RemoveFiles action. Make the execution of this action only apply on uninstall by giving it the condition REMOVE~="ALL"

2. To this If Statement add a "Call Custom DLL From Destination" custom action with the settings:

Custom Action Name: SETUPREMOVEFROMSOURCELISTA

DLL File: [SystemFolder]setupapi.dll

Function Name: SetupRemoveFromSourceListA

Parameter: dword, Constant, 00000100

Parameter: string pointer, Constant, ,[Path to driver.inf file](Don't enclose paths in double quotes)

Return Value Type: dword

Return Property: DLLRETURN

Done!

A template for this process is available for download from http://www.appdeploy.com/downloads/local/