Condividi tramite


App-V 5 Getting globally published packages

Hi all,

I've been asked recently is there a way to get a list of the globally published packages without using the App-V 5 PowerShell cmdlets? Traditionally you would go into PowerShell and run the following command:

 Get-AppvClientPackage -all | Where-Object { $_.IsPublishedGlobally -eq $true }

The result would look like this:

GlobalPackages

The question still stands is there a way to check for globally published packages without PowerShell? Well seeing as I'm talking about it the answer is Yes. The App-V Client writes information about Globally Published Packages to the registry on the machine. It's located in the following location:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppV\MAV\Configuration\Packages

If you open this location and browse the key list you we see a REG_DWORD for "Global" if it published globally:

GlobalFlag

For Packages that aren't Globally published the REG_DWORD isn't present in this location:

NoGlobalFlag

Now lets gather all the Packages on the machine that are Globally Published using a registry query. (Note: I'm still going to use PowerShell to run the query)

 # Variables
$nodeName = "localhost"
$Machine = "Localmachine"
$MAV = "SOFTWARE\Microsoft\AppV\MAV\Configuration\Packages"

# Opening Registry
$registry = [microsoft.win32.registrykey]::OpenRemoteBaseKey("$Machine",$nodeName)

$Configuration = $registry.OpenSubKey($MAV)
$Packages = $Configuration.GetSubKeyNames()

write-host

    foreach($Package in $Packages){

    $PGVG = $Package.Split("_")
    $PG = $PGVG[0]
    $VG = $PGVG[1]

    $ValueNames = $registry.OpenSubKey("$MAV\$Package")

    $Values = $ValueNames.GetValueNames()

        if($Values -contains "Global"){

        write-host "PackageGUID:"$PG
        Write-Host "VersionGUID:"$VG
    
        $PN = Get-AppvClientPackage -PackageId $PG -VersionId $VG -all | select Name
        $PName = $PN.Name
    
        write-host "PackageName:"$PN.Name

        Write-Host "Globally Published Package" -f Yellow

        $Value = $ValueNames.GetValue("Global").ToString()
        write-host

        }

    }

Once you have run the above it will return the globally published packages without the App-V 5 PowerShell cmdlets.

GetGlobalPackages

SCRIPT 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.

David Falkus | Senior Premier Field Engineer | Application Virtualization, PowerShell, Windows Shell

Comments

  • Anonymous
    April 19, 2016
    Good one.