Tuesday, March 15, 2016

How to create AppPaths for already sequenced application - App-V 5.0

Question: I have an App-V 5.1 sequenced application and I have a requirement. When entering the application name in Run command it should open up the App-V virtual application. For example, when we enter iexplore in Run, it opens up internet explorer.


Solution: You can use the AppPath subsystem in App-v 5.0 and higher. This subsystem exposes the App Path registration of a virtual application to the native operating system. Using this registration, the operating system can find the application’s executable. This feature is usually used by an application to avoid modifying the system PATH environment variable.


Reference - https://blogs.technet.microsoft.com/appv/2013/01/03/microsoft-application-virtualization-5-0-integration/


So how can we implement this in the virtual package? If package has been already sequenced, then you can edit the Dynamic configuration file and add the AppPath subsystem.


<AppPaths Enabled="true">
        <Extensions>
          <Extension Category="AppV.AppPath">
            <AppPath>
              <Name>app.exe</Name>
              <ApplicationPath>[{ProgramFilesX86}]\app\app.exe</ApplicationPath>
              <PATHEnvironmentVariablePrefix>[{ProgramFilesX86}]\app\</PATHEnvironmentVariablePrefix>
              <ApplicationId>[{ProgramFilesX86}]\app\app.exe</ApplicationId>
            </AppPath>
          </Extension>
        </Extensions>
 </AppPaths>



In the below example we have added AppPath subsystem for AstroGrep.exe. After adding and publishing it with the dynamic config file, you can see the AppPath being created in the Local registry. Now when you type Astrogrep in Run command it will open up the virtual AstroGrep package.





If you have published the package to user, then the AppPath will be created in the HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths








If you have published the package globally, then the AppPath will be created in the HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths





To know more about App Path check here - https://msdn.microsoft.com/library/windows/desktop/ee872121#appPaths


Scenario:


What if suppose already a local install of the same application may be a different version with App Path is present and App-V package is published.


The App-V package will replace the App Path and point it to the virtual location of the exe and vice versa. Lets consider an example with Mozilla Firefox.


First a local install of the Mozilla Firefox was done and we can see the App Path for firefox.exe pointing to the local install folder c:\Program Files(x86)\Mozilla Firefox\firefox.exe





Now an App-v package for Mozilla Firefox with App Path subsystem is published globally. You can see that the App Path for firefox.exe has been modified to virtual package location
%AllUSERSPROFILE%\Microsoft\AppV\Client\Integration\21546D08-2EEA-4DE8-8290-C7449E707457\Root\VFS\ProgramFilesX86\Mozilla Firefox\firefox.exe





If you type firefox in Run command now, it will open the virtual package and not the local one as the App Path points to the virtual package exe.


What happens when you unpublish the App-V package first. It will replace the App Path back to the local install location for firefox.exe.





Suppose if the local package is uninstalled first, it will completely remove the App Path registry for firefox.exe. Now when you type firefox in Run, it wont work. In order to bring back the virtual path for firefox.exe in App path, you need to repair the firefox app-v package using Repair-AppvClientpackage -Extensions command.


No comments:

Post a Comment