How to run custom action as admin (elevated) under Win 7 - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

jcyr
Posts: 9
Joined: Sun Apr 18, 2010 8:23 pm

How to run custom action as admin (elevated) under Win 7

My install package installs a service which supersedes another service that I need to stop and disable. I have an entry point in a DLL that does this quite well (stop and disable a service) when run as administrator. I can't figure out how to get Advanced Installer 7.3.1 to invoked my DLL function elevated. I've tried invoking it as a custom action under the install standard action. I've also tried 'Run as Administrator' as a button 'DoAction'. In both cases I'm getting an access denied from my OpenSCManager call indicating that I am NOT running as administrator!!!

How can I run install code elevated under Vista or Windows 7???
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: How to run custom action as admin (elevated) under Win 7

Hi,

Try running the custom action after InstallExecuteSequence -> InstallInitialize as Deferred with no impersonation. This way it should run under the local system account with full privileges.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”