PowerShell Script to test App-V 5.0 Packages

I use the below PowerShell script code for testing my App-V packages prior to publishing them officially.  The top portion will add the package on the local system.  While the second portion will remove the package once my testing is complete.  For easiest execution, I use the PowerShell ISE to just run the code segments that I need.  The values to add for yourself are:

  1. pkgPath – the UNC to the AppV files
  2. pkgAppV – the name of the .app file
  3. pkgXML – the name of the .xml file
  4. pkgName – change the “Part_Of_App_Name” value to what is appropriate (such *java*)
# First code adds the package
clear
$pkgPath = "\\server\path\"
$pkgAppV = $pkgPath + "FileName.appv"
$pkgXML = $pkgPath  + "DeploymentConfig.xml"
Add-AppvClientPackage -Path $pkgAppV -DynamicDeploymentConfiguration $pkgXML | Publish-AppvClientPackage -Global

# Next code removes the package
$pkgName = Get-AppvClientPackage -Name *Part_Of_App_Name*
Unpublish-AppvClientPackage -PackageID $pkgName.PackageId -VersionID $pkgName.VersionId
Remove-AppvClientPackage -PackageID $pkgName.PackageId -VersionID $pkgName.VersionId

Filed under: App-V 5.0, Scripting

email

Written by , Posted .