Share via

App RUNASADMIN in registry

Anonymous
2023-05-16T19:40:27+00:00

For Windows 10 and below, there were two registry keys when an app was set to run as an administrator. These were:

For the user logged in:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

For all users:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

However, this is no longer the case in Windows 11.

Is there a different registry key that would expose when an app is run elevated or is there any way to know, on the backend, when an app is set to run elevated?

Windows for home | Windows 11 | Settings

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

9 answers

Sort by: Most helpful
  1. Ramesh 176.3K Reputation points Volunteer Moderator
    2023-05-17T18:44:47+00:00

    The properties for the .lnk file are stored within the .lnk file (Ref: "LinkFlags structure" documentation at Microsoft Lean). Not sure how to read the setting programmatically, but this GitHub link has some useful info, especially the comment from "tresf"

    <quote>

    • On Windows 10, I can confirm that byte[21] changes from 0x03 to 0x23 when the Run As Administrator flag is checked.

    </quote>

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Ramesh 176.3K Reputation points Volunteer Moderator
    2023-05-16T20:14:48+00:00

    The same build, 22621.1702. 22H2 stable.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Ramesh 176.3K Reputation points Volunteer Moderator
    2023-05-16T19:51:16+00:00

    Hi Jeff,

    The two keys are valid for Windows 11 as well. I've verified it.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2023-05-17T14:40:59+00:00

    Ok I see what the issue is. I have a shortcut to the program on my desktop. If you go to the properties and click on the Advanced button under the Shortcut tab and set it to Run as administrator, it's not creating the registry key, even though it does run the program elevated. If you set it to run as an administrator under the Compatibility tab, the registry keys show as expected.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2023-05-16T20:08:59+00:00

    Which version of Win11 did you verify with? I'm running 22H2 22621.1702.

    Was this answer helpful?

    0 comments No comments