How to get installed package's full name (C++)?

%3CLINGO-SUB%20id%3D%22lingo-sub-580840%22%20slang%3D%22en-US%22%3EHow%20to%20get%20installed%20package's%20full%20name%20(C%2B%2B)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-580840%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20uninstall%20a%20MSIX%20package%20through%20C%2B%2B%20program%2C%20and%20know%20of%20the%20RemovePackageAsync%20method.%20However%2C%20for%20that%20method%20to%20work%2C%20you%20require%20the%20package's%20full%20name%20(i.e.%20MSIXSample_x64_...).%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20get%20the%20installed%20package's%20full%20name%20so%20that%20I%20can%20use%20it%20as%20a%20parameter%20for%20RemovePackageAsync()%2C%20or%20is%20there%20a%20better%20way%20to%20uninstall%20the%20package%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDickson%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-624133%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20installed%20package's%20full%20name%20(C%2B%2B)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624133%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F263025%22%20target%3D%22_blank%22%3E%40dicksonchan%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20use%20PowerShell%20cmdlets%20to%20get%20the%20package's%20full%20name%3A%26nbsp%3B%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fappx%2Fget-appxpackage%3Fview%3Dwin10-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fappx%2Fget-appxpackage%3Fview%3Dwin10-ps%3C%2FA%3E%3C%2FFONT%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20also%20use%20a%20PowerShell%20cmdlet%20to%20remove%20the%20MSIX%20package%20as%20well%3A%26nbsp%3B%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fappx%2Fremove-appxpackage%3Fview%3Dwin10-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fappx%2Fremove-appxpackage%3Fview%3Dwin10-ps%3C%2FA%3E%3C%2FFONT%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBest%2C%3C%2FP%3E%0A%3CP%3ESharla%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-653761%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20installed%20package's%20full%20name%20(C%2B%2B)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-653761%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F263025%22%20target%3D%22_blank%22%3E%40dicksonchan%3C%2FA%3E%26nbsp%3BIf%20you%20are%20using%20the%20PacakgeManager.RemovePackage%20you%20can%20also%20use%20the%20FindPackage%20option%20as%20well%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fuwp%2Fapi%2Fwindows.management.deployment.packagemanager.findpackage%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fuwp%2Fapi%2Fwindows.management.deployment.packagemanager.findpackage%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-654207%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20installed%20package's%20full%20name%20(C%2B%2B)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-654207%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F73899%22%20target%3D%22_blank%22%3E%40John%20Vintzel%3C%2FA%3E%26nbsp%3BIf%20I%20use%20FindPackage()%2C%20I%20would%20require%20the%20package's%20full%20name%20for%20the%20method%20to%20work%2C%20which%20is%20what%20I%20am%20still%20having%20trouble%20looking%20for%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-654215%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20installed%20package's%20full%20name%20(C%2B%2B)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-654215%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F145112%22%20target%3D%22_blank%22%3E%40Sharla%20Akers%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20know%20of%20the%20PowerShell%20commands.%20But%20is%20there%20a%20way%20to%20retrieve%20the%20package%20full%20name%20as%20a%20string%20so%20that%20I%20can%20automate%20these%20commands%20(Get-AppxPackage%20to%20get%20the%20name%20and%20Remove-AppxPackage%20immediately)%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-654225%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20installed%20package's%20full%20name%20(C%2B%2B)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-654225%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F263025%22%20target%3D%22_blank%22%3E%40dicksonchan%3C%2FA%3E%26nbsp%3BSorry%2C%20it%20should%20be%20FindPackages.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fuwp%2Fapi%2Fwindows.management.deployment.packagemanager.findpackages%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fuwp%2Fapi%2Fwindows.management.deployment.packagemanager.findpackages%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EJohn.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi

 

I am trying to uninstall a MSIX package through C++ program, and know of the RemovePackageAsync method. However, for that method to work, you require the package's full name (i.e. MSIXSample_x64_...). 

 

Is there a way to get the installed package's full name so that I can use it as a parameter for RemovePackageAsync(), or is there a better way to uninstall the package? 

 

Thanks!

 

Dickson

5 Replies

Hi @dicksonchan,

 

You can use PowerShell cmdlets to get the package's full name: https://docs.microsoft.com/en-us/powershell/module/appx/get-appxpackage?view=win10-ps 

 

You can also use a PowerShell cmdlet to remove the MSIX package as well: https://docs.microsoft.com/en-us/powershell/module/appx/remove-appxpackage?view=win10-ps 

 

Best,

Sharla

@dicksonchan If you are using the PacakgeManager.RemovePackage you can also use the FindPackage option as well: https://docs.microsoft.com/en-us/uwp/api/windows.management.deployment.packagemanager.findpackage

@John Vintzel If I use FindPackage(), I would require the package's full name for the method to work, which is what I am still having trouble looking for

Hi @Sharla Akers 

 

I know of the PowerShell commands. But is there a way to retrieve the package full name as a string so that I can automate these commands (Get-AppxPackage to get the name and Remove-AppxPackage immediately)?