开发者

Can't delete folders created by Windows services via my app uninstaller?

My MSI installer registers couple of Window NT services with the SCM. The services write data to a temporary folder which by default gets ownership of the SYSTEM account. During uninstall, the uninstaller process is unable to delete the folders as the temp folders are owned by Administrator with read/write access. The current user is an admin开发者_如何学JAVAistrator but does not have explicit read/write permissions to these folders. To make it worse the app is a Java app that is controlled by a Window service.

What's the best strategy for the uninstaller ? Should it - use native code to change permissions of the folders ? - How will that work with UAC enabled ?


I ended up requesting admin privilege elevation to delete the folders. Leaving the folders around trips the upgrade so no I can't leave them as suggested by a poster.


I think that you're trying to solve the wrong problem with the installer. Think a bit wider - is the installation program responsible for the data created by the software it installs? The answer is NO. When you uninstall Microsoft Office, does it drop all the *.doc files you created, or its own internal logs in TEMP? I don't think so.

Temporary folders are good to keep such kind of temporary data and it's generally OK to leave it there. If it's not sensitive data, you can always delete it in a bunch. Many guidelines about how to clean the OS in general recommend cleaning up the TEMP folders.

So, instead of inventing complex ways and workarounds with permissions, I would recommend just leave it as is.


If you have a per-machine installer the uninstall process should use the TrustedInstaller account which has full privileges. Try creating an uninstall log to determine why the folders are not removed.

If it's indeed a permissions problem, a solution would be to configure your service so it sets the appropriate permissions on the folder it creates.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜