Q:

Deleting files from the users profile when uninstalling an Inno based setup

Is it possible to delete files from this folder and how?
Currently i have this which doesnt work
[UninstallDelete]
Type: files; Name: "{userappdata}\Roaming\Myapp\*";
Type: files; Name: "{commonappdata}\Roaming\Myapp\*";
Type: files; Name: "{app}\*.*";

[Code]
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
  sUnInstPath: String;
  sUnInstallString: String;
begin
  sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
  sUnInstallString := '';
  if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
  Result := sUnInstallString;
end;

/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
  Result := (GetUninstallString() <> '');
end;

/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
  sUnInstallString: String;
  iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString

  // default return value
  Result := 0;

  // get the uninstall string of the old app
  sUnInstallString := GetUninstallString();
  if sUnInstallString <> '' then begin
    sUnInstallString := RemoveQuotes(sUnInstallString);
    if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
      Result := 3
    else
      Result := 2;
  end else
    Result := 1;
end;

/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if (CurStep=ssInstall) then
  begin
    if (IsUpgrade()) then
    begin
      UnInstallOldVersion();
    end;
  end;
end;

A:

While Inno can remove files from the profile of the user running the uninstaller, it can not touch any other user's profile.
If the user trying to run the uninstaller is a limited user, it will ask for the admin details and so any {user...} constants will resolve to the admin user, NOT the limited user.
Your best option in this case is it leave any of the user's configuration and data in case they want to reinstall or have roaming profiles. Also note that in your code above, the old setup is removed during the upgrade which will trigger the "remove all the user's data" option. I'm sure that's not what you want...

