Azure VDI and AppX Apps Disappearing
An interesting ticket came bubbling up from the service desk where a group of users were unable to use an internal application after a reboot of the Azure VDI environment.
In working the issue, I discovered that the in house developers recently moved from a traditional .exe installation method to using the Windows AppX method, which uses the Windows Store to install the application. The problem presented itself when the users uninstalled the old version of the application and then installed the new version. We have an auto-log off script and auto-power down if no users connected to the host Azure Function, so to the users, when they would log off they would experience it as if it was a reboot of the session host, however the problem still presents itself if the user just logs off and immediately back on, and not just a full reboot / power off of the session host.
If a user installs an AppX application and/or an app from the Windows Store, the program files are installed in ‘C:\Program Files\Windows Apps’. Windows creates the list of installed apps on a per user basis, and since FSLogix essentially deletes the user profile on logoff, Windows treats the log on as a new user and not an old user, so it “removes” any apps that were installed previously and only installs apps that are built into Windows, aka Windows inbox apps. This is a documented, known issue from Microsoft.
I was able to get the app to show up reliably for me when logging off / on by applying this workaround found on the internet, whereas before it would disappear and I would have no access to the application.
This workaround included the following:
- Installing the application as normal
- Launching the application
- Figure out the full application name using Powershell
-
Get-AppxPackage | Where-Object {$_.Name -like "*WhatsApp*"}
- Add the full package name as a key to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications
I expanded on that workaround by adding the following to the created key:
- Path
- Region
Then run the re-registration of the application via Powershell.
$AllUserAppsKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications"
$AllUserApps = Get-ChildItem -Path $AllUserAppsKey
ForEach($Key in $AllUserApps) {
Add-AppxPackage -DisableDevelopmentMode -Register (Get-ItemProperty -Path $Key.PsPath).Path
}
This resolved the issue of the application not being available for the end user. This doesn’t solve the long term issue in that the application will now need manual IT intervention to update since we have to update the name and path of the registry item and re-run the powershell commands to make it available, but that’s a problem for another day.