Using __COMPAT_LAYER when troubleshooting App-V with Regedit

Have you ever tried to launch regedit inside of the App-V bubble for some trouble-shooting only to find that you can’t see registry entries that should be there in your sequence? Chances are a UAC prompt popped up and regedit ended up being launch outside of the virtual environment.

To fix this, you can use the __COMPAT_LAYER environment variable, which is often set inside the OSD files when you sequence an app that wants to run with the ‘requireAdministrator’ execution level.

So, launch a CMD prompt in the bubble:

sfttray /exe cmd "My app 1.0"

Or better yet use ACDC to save yourself some typing. Once the prompt has appeared, type the following:

set __COMPAT_LAYER=RunAsInvoker
regedit

Now regedit will be able to show you the entries you could not see before. Alternatively, if you just want to do a quick check and you know the location, you can use the reg command:

reg query HKLM\Software\MyApp

This works for tools other than regedit too, for example odbcad32.exe used to manage ODBC settings.

UPDATE:

After delving deeper into this issue, it seems that standard users can launch regedit and odbcad32 directly in the bubble without any issues because these applications have their execution level set to ‘highestAvailable’, meaning they will only try to elevate if run by a user with admin rights.

So, if you are running as an admin user, from a non-elevated command prompt, you must set the variable above to launch any apps that require elevation – or alternatively just make sure you run ACDC or your CMD prompt (or whatever else you use to launch sfttray) elevated in the first place so that they can launch these apps without issue.

Leave a Reply