Powershell Help - Extract or load AppxManifest.xml from an .appv file after sequencing RRS feed

  • Question

  • Curious is anyone might be able to help with this - it doesn't seem unzip can extract a .appv file and I'm uncertain of what other methods might exist to work with an appv file in a zip capacity.  I need to programmatically get the VersionID of a product right after the sequence has been saved.  I know how to do this manually of course (copy and paste from sequencer, or associate .appv as a compressed folder and get the VersionID out of Appxmanifest.xml).  However I'm looking for a way to automate this in a powershell script I'm writing.  It seems extracting the AppxManifest.xml and loading it into powershell will be the simplest automated solution.

    Or if someone knows anywhere else this VersionID might be that would be great.  I've hunted filesystem and registry.  The sequencer only writes the PackageID to the DDC and DUC XML files.  I was also hoping WMI might have it, but the root/appv namespace also doesn't exist on the sequencing machine.

    Thanks for any help / feedback-

    Sunday, April 14, 2013 4:27 PM


All replies

  • Are you looking to get the package information from the Content share or getting it from the packages added to the client?

    Get-AppvClientPackage returns both the Package and Version GUID for packages added to the local client.

    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually answer your question). This can be beneficial to other community members reading the thread.

    This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or other MVPs.

    Twitter: @stealthpuppy | Blog: stealthpuppy.com | The Definitive Guide to Delivering Microsoft Office with App-V

    Sunday, April 14, 2013 6:17 PM
    • Marked as answer by ridenotslide Sunday, April 14, 2013 8:31 PM
    Sunday, April 14, 2013 6:24 PM
  • This would be right after sequencing.  Before the sequence has even been copied from the sequencing machine to my content share.  I'm building a custom XML file that I'm using later in the process for a custom solution.  One of the elements I want in this custom XML file is VersionID.  So quick process snapshot..

    1. Sequence application

    2. Save sequence to folder on sequence machine

    3. Copy powershell script to appv sequence folder and run (this is where I'd want it to pull the versionID GUID)

    4. Delete powershell script and then copy appv sequence including custom XML file to content share

    5. Publish, etc..

    Here is a copy of my script if it helps.  Looking to take lines 21-23 from a manual input box to automatically looking up VersionID.

    #Determine the name of the AppV application we're using.  Can be specified as command line arg or search dir for .app file
    $name = $args[0]
    if ($name -eq $null){
    $name = Get-ChildItem $PWD -Recurse '*.appv' | Select-Object -ExpandProperty Name 
    $name = $name -replace ".appv",""
    #Create the filepath fora the XML file we want to build, and then build out XML write object
    $filePath = $pwd.ToString() + '\' + $name + '.xml'
    $xmlWriter = New-Object System.XMl.XmlTextWriter($filePath,$null)
    $xmlWriter.Formatting = "Indented"
    $xmlWriter.Indentation = "4"
    #Start our XML document and write the root element to match the AppV Name
    #Load the DUC XML file so we can automatically add PackageID.  Prompt for VersionID manual input.
    [xml]$appNameXML =  Get-Content ($name + '_DeploymentConfig.xml')
    $versionID = [Microsoft.VisualBasic.Interaction]::InputBox('Please enter VersionID GUID','XML Generator','VersionID')
    #Bring in all the applications for this AppV sequence by reading the DUC XML file Applications elements
    $allApps = $appNameXML.DeploymentConfiguration.UserConfiguration.Applications.Application | Select-Object -ExpandProperty Id
    #Drop the AppV Tokens that won't be needed for our XML file
    foreach ($application in $allApps) {
    $application = $application.replace("[{ProgramFilesX86}]","")
    $application = $application.replace("[{AppVPackageRoot}]","")
    $application = $application.replace("[{ProgramFilesCommonX64}]","")
    #Now lets split this into an array so we can use the EXE name as our XML element
    $elementName = $application.Split("\")
    $elementName = $elementName[-1] -replace ".exe",""
    #Write the EXE path to this element - use Substring(1) to drop the leading \
    #End our Root element and document now
    #Finalize, flush, and close the XML file

    Sunday, April 14, 2013 6:34 PM
  • Perfect.  Thank You!
    Sunday, April 14, 2013 8:31 PM