locked
App-V 5.0 SP2 - PackageID & VersionID RRS feed

  • Question

  • I use PowerShell for testing newly sequenced applications. It's very basic with add and publish ... then unpublish and remove for cleanup.  In general my PS script is:

    # First code adds the package
    clear
    $pkgPath = "\\svr\path" + "\"
    $pkgAppV = $pkgPath + "AppName.appv"
    $pkgXML = $pkgPath  + "AppName_DeploymentConfig.xml"
    Add-AppvClientPackage -Path $pkgAppV -DynamicDeploymentConfiguration $pkgXML | Publish-AppvClientPackage 
    
    # Next code removes the package
    $pkgName = Get-AppvClientPackage -Name *AppName*
    Unpublish-AppvClientPackage -PackageID $pkgName.PackageId -VersionID $pkgName.VersionId
    Remove-AppvClientPackage -PackageID $pkgName.PackageId -VersionID $pkgName.VersionId

    This works fine with applications sequenced with App-V 5.0 SP1, but not all packages sequenced with SP2.  What I've found is that there are duplicate or multiple entries for the properties of the package.  For example, if I do $pkgName.PackageID, there are 2 GUIDs.

    Example with SP1:

    • $pkgName = Get-AppvClientPackage -Name crystal*
      write-host $pkgName.Name
      write-host $pkgName.PackageId
      write-host $pkgName.VersionID
    • Crystal Reports XI Release 2
      0c868c6d-3ab8-4410-a65e-e2617af27a30
      e153f59f-b66b-4fb4-9e0d-5bc30e8a16e5

    Example with SP2:

    • Get-AppvClientPackage -Name webdrive*
      write-host $pkgName.Name
      write-host $pkgName.PackageId
      write-host $pkgName.VersionID
    • WebDrive 11.00.2749 x64 WebDrive 11.00.2749 x64
      a3e6a133-4521-4e93-8383-0dedf60414c6 a4dddd7f-e316-4321-9097-0a76c1784d9f
      d9eb3617-c359-4e32-9a50-34b8b0f9c8be be45eba9-40a6-4a2a-b2ac-04feffa30ad6

    See the additional entries?  Is this a bug?


    Nick Moseley | http://t3chn1ck.wordpress.com


    • Edited by nickmo Tuesday, February 11, 2014 9:34 PM fixed code block
    Tuesday, February 11, 2014 9:32 PM

Answers

  • With your tip and finding an example of handling an PowerShell array/collection, I've found the following works better now for my cleanup script and will handle multiple apps of the same name.

    foreach ($pkgName in Get-AppvClientPackage -Name *AppName*) {
        write-host $pkgName.Name
        Unpublish-AppvClientPackage -Name $pkgName.Name
        Remove-AppvClientPackage -Name $pkgName.Name
    }


    Nick Moseley | http://t3chn1ck.wordpress.com

    • Proposed as answer by znack Wednesday, February 12, 2014 5:01 PM
    • Marked as answer by David WoltersModerator Thursday, February 20, 2014 7:54 PM
    Wednesday, February 12, 2014 12:41 AM

All replies

  • *Facepalm*  I was able to realize the cause of my problem after the writeup.  The system had cached entries of previous items with the same name, so the $pkgName became an array in that respect.

    Regardless, does anyone have a suggestion for how to better handle cleanup of these items based upon my script?


    Nick Moseley | http://t3chn1ck.wordpress.com

    Tuesday, February 11, 2014 9:43 PM
  • Is there a reason you are using the GUID? I believe you can just use the name that you're already gathering in order to remove the application.

    But what you have looks pretty good to me


    PLEASE MARK ANY ANSWERS TO HELP OTHERS Blog: rorymon.com Twitter: @Rorymon

    • Proposed as answer by znack Wednesday, February 12, 2014 5:01 PM
    Wednesday, February 12, 2014 12:11 AM
  • That's a great point. I made the script so long ago, that I don't recall my reasons for using the PkgID / VerID.  And now I can't think of any possible advantages, so I will probably simplify that portion.

    I'll still need to rework the script to account for multiple instances.


    Nick Moseley | http://t3chn1ck.wordpress.com

    Wednesday, February 12, 2014 12:19 AM
  • With your tip and finding an example of handling an PowerShell array/collection, I've found the following works better now for my cleanup script and will handle multiple apps of the same name.

    foreach ($pkgName in Get-AppvClientPackage -Name *AppName*) {
        write-host $pkgName.Name
        Unpublish-AppvClientPackage -Name $pkgName.Name
        Remove-AppvClientPackage -Name $pkgName.Name
    }


    Nick Moseley | http://t3chn1ck.wordpress.com

    • Proposed as answer by znack Wednesday, February 12, 2014 5:01 PM
    • Marked as answer by David WoltersModerator Thursday, February 20, 2014 7:54 PM
    Wednesday, February 12, 2014 12:41 AM
  • Great! I would guess that should work the same and reduces the complexity involved. Good job!

    PLEASE MARK ANY ANSWERS TO HELP OTHERS Blog: rorymon.com Twitter: @Rorymon

    Wednesday, February 12, 2014 4:54 AM