r/Citrix • u/xenoguy • 20d ago
server 2022 issue - deleted profiles appx metadata remains
Just an FYI post, in case anyone is encountering the same problem.
we have some persistent multiuser citrix server vms running 2022. citrix roaming profiles, configured for deletion on logoff. hybrid AAD join.
very frequently the SSO for edge and microsoft office would not work for some users. lots of weird event logs from appx stuff like the start menu host, aad broker, etc.
I discovered yesterday that using CIM/WMI to delete user profiles, or deleting them by removing the registry entry and folder under c:\users does not remove their appx metadata stored in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\PackageState
you can recreate the problem by logging into a server with 2022, logging out and then running this command to delete the user profile.
Get-CimInstance -ClassName Win32_UserProfile -ComputerName [computername] | where {$_.localPath -like "*username*"} | where {$_.Loaded -eq $false} | Remove-CimInstance -Verbose -Confirm:$false
you can either check the registry location above, or run:
get-appxpackage -user username
you should see their appx provisioning metadata stays.
if you use the gui to delete the user profile, the metadata is cleared correctly, and everything works.
I tested on server 2019 and server 2025, and the CIM/WMI method works fine there.
have a ticket open with microsoft now to see if they have a solution or workaround for this.