App-V 5.0 – How to find a deployed package PVAD directory easily

Hi all,

I’ve been onsite with some customers recently doing some troubleshooting of App-V packages and this “little gem” of a question was asked….

“How do I find the Primary Virtual Application Directory (PVAD) of the package on the App-V Client easily?”

To find the PVAD of a deployed App-V application the easiest way is to find the FileSystemMetadata.xml file which is deployed to the App-V Package Installation Root for each package.

If you open the FilesystemMetadata.xml file you will see at the top of the XML the “Filesystem Root” is specified.

Anyone that knows me well I don’t like doing things manually so I checked the web and couldn’t find a scripted way so I thought lets script it.

So this is what I put together…

 

# Finding the package installation root from the App-V Client Configuration

$PIR = (Get-AppvClientConfiguration | where { $_.Name -eq "PackageInstallationRoot" }).Value

    # If the Root is using a variable, converting the path   

    if(($PIR).contains("%") -eq $true){

    $PIR_Path = [System.Environment]::ExpandEnvironmentVariables($PIR) 

    $Cache_Root = $PIR_Path

    } 

    # If no variable is specified defaulting to the result

    else { 

    $Cache_Root = $PIR

    }

# Getting all packages configured on the client

$Packages = Get-Appvclientpackage

# Looping through all the packages and building the path to the file system metadata file

foreach($package in $Packages){ 

# Defining some variables

$Package_ID = $package.PackageId

$Version_ID = $package.VersionId

$Package_Name = $package.Name

# Creating the path to the package cache location

$Package_Cache_Path = $Cache_Root + "\" + $Package_ID + "\" + $Version_ID 

# Defining File System Metadata path

$FileSystemMetadata = "$Package_Cache_Path\FilesystemMetadata.xml"

# Opening the metadata xml file

[xml]$FileSystemMetadata_XML = gc $FileSystemMetadata 

# Finding the Root path

$PVAD = $FileSystemMetadata_XML.Metadata.Filesystem.Root

# Outputting the results out to the host

write-host

write-host "Package Name: $Package_Name" -f Yellow

write-host "Package Cache Root: $Package_Cache_Path"

write-host "PVAD Path: $PVAD" 

}

The result is below…

Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.

I hope this helps finding the PVAD of your App-V 5.0 packages automatically.

David Falkus | Premier Field Engineer | Application Virtualization