none
Issue launching executable with elevated privileges from one without such privileges. RRS feed

  • Question

  • I have a strange problem that only manifests itself occasionally on some machines. So far I have seen this happen on one or two machines on Windows 10. The same thing, however, works fine on *other* machines that are also on Windows 10.

    So I don't think looking at my code is going to be particularly helpful although I will post some snippets below. I have tried several things without much joy.

    Here is the basic scenario:
    ProgramA.exe is our main piece of software. It runs simply under the user's own privileges. Nothing special. But the user can click a button which will launch ProgramB.exe which needs to run with elevated privileges.

    ProgramB.exe's manifest contains the following:

    <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />


    I have tried various things:

    • Simply use Process.Start to directly launch ProgramB.exe
    • Use a ProcessStartInfo with UseShellExecute set to False, or with UseShellExecute set to True - setting appears to make no difference
    • Use a ProcessStartInfo with verb set to "runas" - setting appears to make no difference

    On some machines, Windows 8.1, Windows 10, this works perfectly fine. ProgramB does what it needs to do, with elevated privileges, and all is well.

    But on one or two Windows 10 machines I find it looks like either ProgramB does nothing or it doesn't even get launched.

    Here is the really weird thing. If I go to one of those machines and I run ProgramB.exe manually by simply double clicking on it in Windows Explorer, it works fine.

    If I raise the User Access Control level and I launch ProgramB.exe manually, it does exactly what it should do: it prompts me whether I want to allow the program to make changes. If I click "Yes" it works perfectly.

    So what I need is some sort of a hint as to what might be going on here? And what I could possibly do about it?


    Pino Carafa


    • Edited by rozeboosje2 Tuesday, March 3, 2020 12:08 PM
    Tuesday, March 3, 2020 10:19 AM

All replies

  • Is an error logged in event log?
    when you don't even know if it is launched or not, you should add logging to ProgramB.

    does ProgramB reside in a different directory then ProgramA, and need different assemblies?

    Tuesday, March 3, 2020 5:54 PM
  • Is an error logged in event log?
    when you don't even know if it is launched or not, you should add logging to ProgramB.

    does ProgramB reside in a different directory then ProgramA, and need different assemblies?

    Re: event log - I didn't see anything obvious in the Event Log but having said that, I am not sure I am looking in the right place.

    Re: logging - I added extensive error logging to ProgramB but nothing is recorded. I literally went as far as writing every exception that gets raised into a cumulative String, wrapping the entire process into a try ... catch ... finally so that in the "finally" I write the content of a string to a log file in the %temp% folder. It outputs nothing :(

    Re: directory - yes. ProgramB resides in a different directory than ProgramA. However, I also have a variation on this theme where ProgramB and ProgramA are in the same directory, and the behaviour is the same. Both have been built against .NET Framework 4.6.2 and are using identical 3rd party components if any.

    Further to this we have now found an inhouse laptop exhibiting the same problem so hopefully that will bring us a step closer to a resolution. What I find is that the user running ProgramA does not have Admin rights to the PC. When the user runs ProgramB they are asked for administrator credentials.

    One of the things ProgramB does is it installs an Office Add-in built on Add-in Express. On machines that behave themselves it runs adxregistrator.exe As Administrator and the Add-in becomes available to the user. On this machine, running adxregistrator.exe As Administrator does nothing, and the user actually has to run it under their own credentials.

    So yeah... that's an odd one.


    Pino Carafa

    Tuesday, March 3, 2020 6:05 PM
  • you could use ProcessMonitor, set an include filter for "Process Name" "is" "ProgramB.exe" , enable "Show File System Activity" and "Show Process and Thread Activity", then try again.
    Tuesday, March 3, 2020 7:55 PM
  • The OS parental software is/could be the problem.To save you time,start pc in Safe Mode.normal,open user account,uncheck Parental Software,exit,in cmd type: services.msc in msc,scroll to Parental/double click/set to: Disable,exit msc,restart pc.
    Wednesday, March 4, 2020 3:05 AM
  • Hi rozeboosje2,

    Did you solve your problem? If your question has been answered then please click the "Mark as Answer" Link at the bottom of the correct post(s), so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 25, 2020 7:39 AM
    Moderator