When creating a CloudPaged application drivers need to be carefully handled to ensure they are correctly installed when the application is virtualised; just capturing the install isn't enough.
The guide below shows how to do this correctly:
1) Capture the application as you would normally - making sure any drivers are installed during the wizard (accept any security or certificate warnings).
2) Check that the drivers have been correctly detected and added to the Studio under <SystemDir>\DriverStore\FileRepository
3) Exclude both:
from the Studio project
4) Browse to C:\Windows\System32\DriverStore\FileRepository and copy the drivers here that were added during the install into a new folder in the application program files directory
(Click an image for a bigger version)
5) Create a new batch or powershell file in the same directory as step 4. This file will be used to register and install the drivers.
6) For each driver that is installed during the installer (and copied from FileRepository) add a line to the batch file
pnputil.exe /add-driver "<Path to driver INF file>" /install
Make sure at the end of the BAT file you include Exit 0 to indicate successful completion.
Once created I'd recommend testing the BAT file before continuing to make sure the command syntax and paths are correct.
7) Add the folder created in steps 4 and 5 file into Studio using the add sub-folder command
8) Create a new Configurable App Event from Settings->Configurable App Events->Add
- Trigger = After Virtualization
- Frequency = Fire the first time only
- File Name = <Path to the BAT File created in steps 4 to 6>
- Parameters = <none>
- Run Virtualized = <ticked>
- Run as Local System = <ticked>
- Wait for Handler to Exit = <ticked>
- Time out after = A suitable length of time for the drivers to install (might need some trial and error)
Continue packaging and Cloudifying the application as normal.
When the application is virtualised check that the drivers were successfully loaded by the App Event.
Due to the Exit 0 in the BAT file, the script will return success whether the drivers were installed or not. This is a limitation of the App Event system in Cloudpaging. Exit 0 is required for the AppEvent to wait for the install to complete before running the AppSet.
Drivers with 'Non-Secure' Certificates
Some drivers might be self-signed or signed with an old certificate no longer valid. If this is the case you need to install the certificate before being able to add the drivers using pnputil. The information below describes the extra steps needed to achieve this:
5a) Extract the certificate from the driver
- Right click the driver *.sys file > Properties > Digital Signatures > Select the certificate and click Details
- Click View certificate
- Click Details -> Copy to File -> Follow the wizard to save the certificate
5b) Add the certificate(s) to the Drivers directory from step 4
5c) Add the certificate(s) to the CloudPaging project
certutil.exe -addstore TrustedPublisher "<Path to Extracted Cert>"