App-V 5.0 Demo – Global scripting / Install Hardware Drivers

Posted on Updated on

This is the walk-through for demo #4 from my Microsoft Master webcast on App-V 5.0 scripting.  For the full webcast information, visit https://t3chn1ck.wordpress.com/2014/02/03/playback-of-microsoft-master-app-v-5-0/.

This demo is on scripting the install of hardware drivers (HP printer) when an App-V package is published to a system.  For this example, I am using the standalone App-V infrastructure, not ConfigMgr 2012 R2.

  1. As you may already know, App-V does not capture drivers as part of the package.  So I’ve obtained the driver files specific to that device separately to be ready for use during my sequencing process.appv-driver-demo01
  2. Furthermore in this case, I’ve also created a simple .bat script to perform the install of the drivers since it has a longer more complex command line.  I named that file DriverInst.bat which has the following command.  Note that as part of the command line, I am giving it a custom name of the printer as “HP Univeral AppV”.
    "%~dp0Install.exe" /q /h /npf /dst /smLPT1 /n"HP Univeral AppV", 1, true
    
  3. In this instance, as part of the sequencing process, I have used a script that A) installs the software then B) makes a local copy of those driver files.  In this way, the sequencer ‘detects’ the files and adds them all as part of the package VFS.Important: since I am embedding the driver files as part of the VFS, know that this example will not work well for instances where the package is set to stream from the server.  Rather it will only work on cached copies with the full files.  If you have a streaming server, then the all driver files/installers will need to be added into the scripts folder.
    :: Install directory - C:\Program Files (x86)\HP\HP Officejet 6700
    "%~dp0OJ6700_Basicx64_1315\HP-DQEX5.exe"
    
    xcopy "%~dp0HPUPD\*" "C:\Program Files (x86)\HP\UPD\*" /YES
    
    :: Pause to verify completion
    pause
    
  4. Next we need to add the package to install as part of the DeploymentConfig.xml
    <MachineScripts>
       <PublishPackage>
          <Path>cmd.exe</Path>
          <Arguments>/c [{AppVPackageRoot}]\VFS\ProgramFilesX86\HP\UPD\DriverInst.bat</Arguments>
          <Wait RollbackOnError="true" Timeout="120"/>
       </PublishPackage>
    </MachineScripts>
    
  5. Add the package into the App-V 5.0 console as per standard process.  Follow my guideline on how to “activate” the DeploymentConfig scripts.
  6. For the webcast demo, it was PC targeted (not user) for Global publishing.  In order to quickly have the deployment synchronized with the system, we need to run the below PowerShell commands.
    Note: If UAC is enabled for the system, this will need to execute in an elevated command shell.

    Get-AppvPublishingServer | Sync-AppvPublishingServer -Global
    

Once the package is added to the system, we now show our “App-V” printer software was added as well as the printer hardware!
appv-driver-demo02

Additionally, you can see in the App-V operational events where that the .bat script was executed from within the package.
appv-driver-demo03

Advertisements

2 thoughts on “App-V 5.0 Demo – Global scripting / Install Hardware Drivers

    Playback of Microsoft Master App-V 5.0 | MS Tech BLOG said:
    February 16, 2014 at 2:21 pm

    […] App-V 5.0 Demo – Installing Hardware Drivers | t3chn1ck […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s