Running as Administrator only during Uninstall - Advanced Installer Community
DiegoCP
Posts: 139
Joined: Fri Jan 23, 2015 1:02 pm

Running as Administrator only during Uninstall

Hello,

i have an issue that can only be fixed by the uninstall running as administrator.

The context is:

I have some files in Program Data Folder, and i save so images there also but in windows every time i change a thumbnail in my app Windows creates a thumbs.db which cannot be removed expect with Administrator Privileges.

I cannot use the Run as Administrator option in install parameters because that brings some issue in it self.

My app can install for current user and all users and Run as Administrator makes current User always be the Administrator this cannot be.

Is there any good way to run uninstall with Administrator Privileges so i can remove my folder in the Program Data without asking user for permissions?

Thank You for your Help,
Diego.
Sorin
Posts: 663
Joined: Mon May 08, 2017 1:03 pm

Re: Running as Administrator only during Uninstall

Hello,

Please note that it is not possible for a non-Administrator user to delete files, if these files have permissions rules set only for Administrator. The UAC elevation prompt will be displayed.

Your desired behaviour could be achieved by a custom action configured to run with "Execution Stage Condition" configured on uninstall. The "Run as Administrator" option should also be enabled.

This custom action could, for example, launch a batch file that deletes the file or folder.

Hope this helps!

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”