Hello!
I have some users who are part of a domain migration process and afterward, for some users, the majority of their Microsoft store apps stop working. I have found, if the user is an admin, I can launch PowerShell as admin under their user and fix the apps running the following command:
Get-AppxPackage -allusers | foreach {Add-AppxPackage -register "$($_.InstallLocation)\appxmanifest.xml" -DisableDevelopmentMode}
I tried running the above command using SCCM but running under system context does not seem to fix the apps. The -allusers command above I am assuming is only for getting a list of all apps installed for any user and the piped register command afterward is only for the current user running the command (system). Basically, I assume this is fixing the apps only for the system account and not the actual user.
Because of this, I thought Execute-ProcessAsuser would be a perfect solution but it doesn’t seem to be working. I use it to launch the above command from install.ps1, which does open, but it gets snagged at the very first Get-AppxPackage -allusers command with an error of “Access is denied”. If I remove the -allusers it then does attempt to register the apps it found for that user, but every app it tries to register also gets access denied. Here is what I am running:
Execute-ProcessAsUser -Path “$PSHOME\powershell.exe” -Parameters “-Command & { & `"$dirfiles\Install.ps1`" Exit `$LastExitCode }” -Wait
The default for Execute-ProcessAsUser should run with “HighestAvailable” but, just to be sure, I have tried putting “-Runlevel HighestAvailable” in. It didn’t make a difference.
Any help would be appreciated.