Custom action with admin privileges - 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!

ChrisGue
Posts: 116
Joined: Tue Feb 03, 2009 7:26 pm

Custom action with admin privileges

Hello,

I use AI 7.1.3 enterprise.

During the installation I want to add a task in windows task scheduler. As the tasks pane in AI does not offer all the options I need, I want to import the task during installation via a command line from an XML file, e.g.:
schtasks.exe /Create /TN MyCompany\MyTaskname /XML "[#MyTaskDefinition.xml]"

But that command line must be execute with admin privileges, but I do not succed to do so, as a custiom action seems always being executed in the environment as the installation was started in, though on Vista and 7 usually without Admin privileges.

Using 'deferred with no impersonation' does not work: schtasks.exe returns an error: "no mapping between acount name and security ids was done."

So, how to start a custom action with Admin privileges?


Thanks,
Chris
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Custom action with admin privileges

Hi Chris,

Setting your custom action with "Deferred, with no impersonation" after InstallExecuteSequence -> InstallInitialize will assure it will run under the local system account with full privileges.

If you need to run the command with full privileges under the current account you should use our predefined "Launch File as Administrator" custom action. Also, here is our user guide reference.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”