SOLVED
Home

Get-AppXPackage, Dependencies, and Impersonation

%3CLINGO-SUB%20id%3D%22lingo-sub-665853%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AppXPackage%2C%20Dependencies%2C%20and%20Impersonation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-665853%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146612%22%20target%3D%22_blank%22%3E%40TIMOTHY%20MANGAN%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20see%20modification%20packages%20using%3A%26nbsp%3B%3CSTRONG%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EGet-AppPackage%20-PackageTypeFilter%20Optional%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EConfigMgr%20and%20Intune%20leverage%20an%20inbox%20CSP%20for%20manageability.%26nbsp%3B%20They%20have%20a%20few%20different%20pivots%20to%20get%20the%20installed%20app%20inventory%20as%20well.%26nbsp%3B%20The%20APIs%20also%20allow%20for%20this%20filtering.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EJohn%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-665835%22%20slang%3D%22en-US%22%3EGet-AppXPackage%2C%20Dependencies%2C%20and%20Impersonation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-665835%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20was%20driving%20me%20nuts%20for%20two%20weeks%20until%20I%20found%20the%20source%20of%20this%20error.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20have%20a%20MSIX%20Package.%26nbsp%3B%20I%20also%20have%20a%20modification%20package%20that%20contains%20a%20plugin%2C%20and%20that%20modification%20package%20AppXManifest%20lists%20dependency%20on%20that%20package%20(a%20plugin).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20manually%20install%20the%20package%20and%20the%20plugin%20package%20while%20logged%20in%20as%20a%20user.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFrom%20that%20user%20account%20I%20run%20the%20Get-AppXPackage%20command.%26nbsp%3B%20The%20returned%20list%20contains%20a%20direct%20entry%20for%20the%20main%20package%20but%20not%20the%20modification%20package.%26nbsp%3B%20I'm%20OK%20with%20that%20because%20the%20modification%20package%20IS%20listed%20under%20the%20%22Dependencies%22%20property%20array%20of%20the%20main%20package.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20have%20a%20background%20process%20running%20under%20the%20local%20system%20account.%26nbsp%3B%20This%20process%20then%20impersonates%20the%20user%20and%20runs%20the%20same%20PowerShell%20query.%26nbsp%3B%20The%20main%20package%20is%20listed%2C%20however%20the%20modification%20package%20is%20NOT%20listed%20under%20the%20%22Dependencies%22%20property%20array.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20appears%20that%20there%20is%20no%20way%20for%20this%20background%20process%20to%20know%20whether%20or%20not%20the%20modification%20package%20is%20deployed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20how%20would%2C%20let's%20say%20Config%20Manager%20or%20Intune%20(or%20my%20code)%20know%20not%20to%20install%20the%20modification%20package%20every%20time%20evaluation%20is%20run%3F%26nbsp%3B%20Smells%20like%20a%20bug%20to%20me.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-665936%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AppXPackage%2C%20Dependencies%2C%20and%20Impersonation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-665936%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%3B%3C%2FP%3E%0A%3CP%3EI%20tested%20the%20PackageTypeFilter%20option%20with%20impersonation%20to%20be%20sure%20it%20works%2C%20and%20it%20does.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EBut%20that%20is%20a%20workaround%20something%20that%20is%20a%20bug.%20It%20doesn't%20make%20sense%20that%20a%20request%20made%20without%20a%20PackageTypeFilter%20doesn't%20populate%20the%20dependencies%20like%20the%20same%20non-impersonated%20request.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20instead%20of%20one%20query%20I%20have%20to%20make%20one%20for%20main%20packages%2C%20one%20for%20optional%20(manually%20filtering%20out%20the%20main%20package%20that%20also%20shows%20up)%2C%20and%20one%20for%20framework.%20Very%20stupid.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-666104%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AppXPackage%2C%20Dependencies%2C%20and%20Impersonation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-666104%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146612%22%20target%3D%22_blank%22%3E%40TIMOTHY%20MANGAN%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20your%20feedback.%26nbsp%3B%20Unfortunately%20this%20is%20something%20we%20are%20unlikely%20to%20service%20in%20in%20market%20OSes%20and%20hopefully%20the%20options%2C%20albeit%20%22very%20stupid%22%20will%20help%20enable%20the%20scenario%20you%20are%20looking%20to%20achieve.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EJohn.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
TIMOTHY MANGAN
MVP

This was driving me nuts for two weeks until I found the source of this error.

 

I have a MSIX Package.  I also have a modification package that contains a plugin, and that modification package AppXManifest lists dependency on that package (a plugin).

 

I manually install the package and the plugin package while logged in as a user. 

 

From that user account I run the Get-AppXPackage command.  The returned list contains a direct entry for the main package but not the modification package.  I'm OK with that because the modification package IS listed under the "Dependencies" property array of the main package.  

 

I have a background process running under the local system account.  This process then impersonates the user and runs the same PowerShell query.  The main package is listed, however the modification package is NOT listed under the "Dependencies" property array.

 

It appears that there is no way for this background process to know whether or not the modification package is deployed.

 

So how would, let's say Config Manager or Intune (or my code) know not to install the modification package every time evaluation is run?  Smells like a bug to me.

 

 

3 Replies
Solution

@TIMOTHY MANGAN 

 

You can see modification packages using: Get-AppPackage -PackageTypeFilter Optional

 

ConfigMgr and Intune leverage an inbox CSP for manageability.  They have a few different pivots to get the installed app inventory as well.  The APIs also allow for this filtering.

 

John

@John Vintzel 

I tested the PackageTypeFilter option with impersonation to be sure it works, and it does. 

 

But that is a workaround something that is a bug. It doesn't make sense that a request made without a PackageTypeFilter doesn't populate the dependencies like the same non-impersonated request.

 

So instead of one query I have to make one for main packages, one for optional (manually filtering out the main package that also shows up), and one for framework. Very stupid.

@TIMOTHY MANGAN 

 

Thank you for your feedback.  Unfortunately this is something we are unlikely to service in in market OSes and hopefully the options, albeit "very stupid" will help enable the scenario you are looking to achieve.

 

John.

 

 

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies