I install the extension (.appx), running in the context of the user, on first run of my separately installed Client, using:
Add-AppxPackage <PathToAppx>
I uninstall it as a custom action when the Client gets uninstalled, as administrator, using:
Remove-AppxPackage <PackageFullName> -AllUsers
The extension, when installed, shows up in Add or Remove Programs and in Edge -> ... -> Extensions.
After uninstallation, the extension gets removed from Add or Remove Programs, but it still shows as "enabled" in Edge -> ... -> Extensions, although the code and assets are gone - it no longer works. Machine restart does not fix it.
When I uninstall it manually - it is a separate app - from Add or Remove Programs, it behaves the same: does not get removed from Edge. [UPDATED]
How do I remove it from Edge? I'm guessing, I will need to modify some registry or file...
The following registry keys in HKEY_USERS need to be deleted for all users after removing the appx package:
\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\ExtensionsStore\datastore\Config\{PackageFamilyName}
\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\PersistedStorageItemTable\ManagedByApp\{PackageFamilyName}
Notice that PackageFamilyName is used here, not PackageFullName.