none
When I try to uninstall my own application I get "You do not have sufficient access to uninstall XXXX"

    Question

  • Hello everyone,

     

    I am facing a rather annoying problem. I have developed a Visual Basic application but this issue happens regardless of the programming language used to make the app. The application consists of a single EXE file. Now I am trying to add install/uninstall capabilities to it without using external setup packagers like InstallShield or whatnot..

    For example I have programmed the command-line switch "/install" to add the necessary registry key values under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall

     

    This has worked flawlessly. Now my application appears in the "Programs and Features" list along with all other installed programs from my computer. Now when I click the "Uninstall/Change" button it is supposed to execute the contents of the "UninstallString" key which is calling my application with the "/uninstall" switch. This in turn will delete itself and remove the entry from the registry.

     

    The problem is that when I click the "Uninstall/Change" button I get an error message saying that I do not have sufficient access to uninstall my app even though I am logged on as an administrator.

     

    It is worth mentioning that if I right click on the executable file, select "Properties" and check the "Run as administrator" option then the uninstall will work like a charm but I would like to know how to make it work without running it as administrator. I mean all other applications can be uninstalled just fine and they are not running as administrator. Also the uninstall will work flawlessly on Windows XP but that was something to be expected. The problem happens both in Vista and Windows 7. In Vista I even get an UAC prompt and after I confirm that it still tells me that I don't have sufficient access.

     

    Any insight into this matter is greatly appreciated. Thank you.


    Saturday, June 18, 2011 12:58 PM

Answers

  • This issue has been solved. The manifest needs to specify: requestedExecutionLevel level="highestAvailable" uiAccess="false"
    Then it will work just fine. If uiAccess is "true" then you get the insufficient access error. If requestedExecutionLevel is "asInvoker" then the executable will not be deleted from Program Files.
    I hope this will help anyone else facing this problem.
    • Marked as answer by Melissa Perry Sunday, June 19, 2011 2:19 PM
    Sunday, June 19, 2011 2:19 PM