We have a Windows application with a component that writes to the ProgramData folder. When the uninstaller is run, the files that are generated by this component are not removed. Using UAC::RunElevated, we first install a third party component into ProgramData
SetOutPath "$RENDERER_INSTALL_DIR"
LogSet On
File /r "${MAGNIFY_DIR}/secRenderer/Arelle/*"
LogSet Off
AccessControl::GrantOnFile "$RENDERER_INSTALL_DIR" "(S-1-5-32-545)" "FullAccess"
During operation, this component writes to its own install directory in ProgramData
During uninstallation, we attempt to delete the folder created above, again using UAC::RunElevated
RMDir /r $RENDERER_INSTALL_DIR
However, the files created by operating the component are not removed.
We have observed that these files are owned by the user who used the component, rather than the Administrator, who nonetheless has full read, write and delete permissions.
How do we make this work?