Request Windows Vista UAC elevation if path is protected?
For my C# app, I don't want to always prompt for elevation on application start, but if they choose an output path that is UAC protected then I need to request elevation. So, how do I check if a path is UAC protected and then how do I request elevation mid-execution? Adrian Clark The best way to detect if they are unable to perform an action is to attempt it and catch the UnauthorizedAccessException . However as @ DannySmurf correctly points out you can only elevate a COM object or separate process. There is a demonstration application within the Windows SDK Cross Technology Samples called UAC