powershellappxappxmanifest

PowerShell : How to Get Indentity information from .appx package path?


I'm trying to write a powershell script where

A- Try to install the package from the Path.

B- If the package is already installed, try to uninstall the old version

C- ReTry Step A.

To do the step B, I've tried to get AppxPackageManifest with

$Manifests = Get-AppxPackageManifest -Package $DeveloperPackagePath.Name

(where DeveloperPackagePath is the full path to the package file.)

Because I need the Identity information to remove the application.

But $Manifests is empty.

Path is valid, and App package is valid too.

Is there a way to get the Identity information with the path to the package?


Solution

  • From what I see in the MS docs the cmdlet that gets the manifests works only for installed packages, not for their source.

    What you want can be done, but you need to work more the get the identity. First you need to use makeappx.exe to extract the package in a temporary location and then you can parse the XML file to get the identiy.