Problems launching bat file - Advanced Installer Community
mbjeff
Posts: 4
Joined: Mon Mar 30, 2015 7:45 pm

Problems launching bat file

Hello,

We're currently evaluating Advanced Installer - I'd like to say that so far it's been a pleasure to use! One problem I'm having is getting a batch file to successfully run during installation. I've read all the documentation and forums posts I can find, but still have had no luck so far. I'm currently using "Launch File" to launch a bat file that I'm including in the install. I've configured the action to:
  • 1) "Run as Administrator"
    2) Execute "When the sytem is being modified (deferred)"
    3) "Run under the LocalSystem account with full privileges (no impersonation)"
I've included a screenshot of the configuration at the bottom of this post (the action is called "CreateConfigFiles"). For simplicity, I'm just using the following batch file:

Code: Select all

echo Installing at %1
timeout /t 10
Each time I run the installer, I'm getting this error:

Code: Select all

MSI (s) (5C:FC) [14:35:55:210]: Executing op: ActionStart(Name=CreateConfigFiles,,)
Action 14:35:55: CreateConfigFiles. 
MSI (s) (5C:FC) [14:35:55:210]: Executing op: CustomActionSchedule(Action=CreateConfigFiles,ActionType=3074,Source=BinaryData,Target=/RunAsAdmin "C:\Program Files\Our Company\Our App\Utility\settings_cfg.bat" "C:\Program Files\Our Company\Our App\",)
CustomAction CreateConfigFiles returned actual error code 1 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (5C:FC) [14:35:55:600]: Note: 1: 1722 2: CreateConfigFiles 3: C:\Windows\Installer\MSI8B90.tmp 4: /RunAsAdmin "C:\Program Files\Our Company\Our App\Utility\settings_cfg.bat" "C:\Program Files\Our Company\Our App\"
Here's what I assume are the relevent sections of my aip file:

Code: Select all

<COMPONENT cid="caphyon.advinst.msicomp.MsiCustActComponent">
    ...
    <ROW Action="CreateConfigFiles" Type="3074" Source="viewer.exe_1" Target="/RunAsAdmin "[#settings_cfg.bat]" "[APPDIR]"" Options="1"/>
    <ROW Action="LaunchFile" Type="2" Source="viewer.exe" Target=""<target file>"" WithoutSeq="true" Options="1"/>
</COMPONENT>

<COMPONENT cid="caphyon.advinst.msicomp.MsiInstExSeqComponent">
    ...
    <ROW Action="CreateConfigFiles" Condition="( NOT Installed )" Sequence="6401"/>
</COMPONENT>

I've verified that the bat file exists where it should, and runs as expected when pasting the above arguments into a console window (I can test this when the error message pops up, before the installation rolls back). Any ideas on what could be wrong? I'm running out of variations to try.
Thanks for any help.
CustomAction.png
CustomAction.png (67.16 KiB) Viewed 2896 times
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Problems launching bat file

Hi and welcome to Advanced Installer forums.

Thank you for your interest in Advanced Installer.

Please note that the "Run under the LocalSystem account with full privileges (no impersonation)" already sets the custom action to be executed with full privileges, so you do not need to set the "Run as administrator" option, too. Sometimes they may conflict with each other. The "Use 64-bit Launcher" option may also not be necessary in your case.

So, can you please test your package with the "Run as administrator" and the "Use 64-bit Launcher" options unchecked and see if it works?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mbjeff
Posts: 4
Joined: Mon Mar 30, 2015 7:45 pm

Re: Problems launching bat file

I wasn't aware those options could conflict with each other. I didn't have any luck with "Run as administrator" with or without "Use 64-bit Launcher". However, it lead me down the right path and I was able to get it working with "Run under the LocalSystem account with full privileges (no impersonation)" and "Use 64-bit Launcher" only (I did keep the "deferred" option in both cases, however).

Thank you!

For anyone reading this later, here's a summary that you can use along with the screenshot above ('X' means check-marked; YMMV):

Code: Select all

-------------------------------------------------------------------------
     Hide program's window
     Run as Administrator
X    Use 64-bit Launcher
-------------------------------------------------------------------------
     Immediately
X    When the system is being modified (deferred)
     During installation rollback
     After the system has been successfully modified (commit)
-------------------------------------------------------------------------
X    Run under the LocalSystem account with full privileges (no impersonation)
X    Wait for custom action to finish before proceeding
X    Fail installation if custom action returns an error
-------------------------------------------------------------------------
Note: I also have "Run as administrator" selected under the "Install Parameters" section.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Problems launching bat file

You're welcome. I'm glad you got this working.

Just let us know anytime you need help.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”