Matt
Posts: 109
Joined: Tue Oct 19, 2010 4:54 pm

Problems running a Batch file.

Tue Oct 19, 2010 5:05 pm

Hi

I am trying to run the following command:

%windir%\system32\netsh.exe http add urlacl url=http://+:<Service Port>/EntraderService user="NT AUTHORITY\NETWORK SERVICE"

The command is being run in a batch file as a custom action. The rest of the install works fine but since iv added this batch file it comes up with an error on install.

I am new to Advanced installer and any feedback or ideas on how to solve this problem would be helpful

Cheers
Matt

Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact:  Website

Re: Problems running a Batch file.

Wed Oct 20, 2010 9:24 am

Hi Matt,

Here is an article that shows how to run a BAT file.

The custom action could fail and due to lack of execution rights. To solve this you can try to set it to run as "Deferred with no Impersonation". This option is available only for custom actions
scheduled between the standard actions "InstallInitialize" and "InstallFinalize" from "InstallExecuteSequence" and it will make the custom action to run with full administrator rights under the SYSTEM account.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Matt
Posts: 109
Joined: Tue Oct 19, 2010 4:54 pm

Re: Problems running a Batch file.

Wed Oct 20, 2010 2:14 pm

Hi Bogdan

I have tried what you have said regarding setting it to run as "Deferred with no Impersonation" and it has not wored however It could be some settings I have configured as I am new to Advanced installer so I have inserted a screen shot of the settings for the custom action incase you can spot any problems.

Cheers
Matt
Attachments
Screenshot.png
Screenshot
Screenshot.png (183.94KiB)Viewed 11831 times

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:  Website

Re: Problems running a Batch file.

Wed Oct 20, 2010 3:48 pm

Hi,

The custom action is not configured correctly. For a "Launch file or open URL" custom action only the Command Line should be modified. The source path should remain unchanged. Please try creating the custom action again and make sure you don't change the source path.

Please note that the "[&Service_Port.bat]" file reference is resolved to the full BAT file path during installation.

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

Matt
Posts: 109
Joined: Tue Oct 19, 2010 4:54 pm

Re: Problems running a Batch file.

Wed Nov 03, 2010 2:46 pm

Hi Cosmin,

Sorry about the late reply I have been out of the office on holiday so havnt had chance to reply to your advice. I have done what you have suggested and this has worked.

Cheers for your help

Matt

ShaunT
Posts: 8
Joined: Tue Jul 13, 2021 10:52 pm

Re: Problems running a Batch file.

Wed Jul 14, 2021 1:32 pm

Hi,

Please note I'm a new user.

I'm trying to add a batch file to my package so that it runs the batch file with any user logged on but it doesn't seem to work correctly.

Attached a couple of screenshots.

Any help would be much appreciated.

Thank you.
Attachments
2Capture.PNG
2Capture.PNG (29.32KiB)Viewed 8323 times
Capture.PNG
Capture.PNG (96.21KiB)Viewed 8323 times

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Problems running a Batch file.

Wed Jul 14, 2021 3:04 pm

Hello and welcome to our forums,

That might happen because you are specifying the file type as being .EXE, while your file is actually a .BAT file.

To fix that, you could remove the current custom action and add a "Launch File" custom action instead, pointing to your .BAT file.

The schedule of your current custom action is correct, therefore the new custom action should be scheduled similarly (after the "Add resources" action group with the "Execution Time" being "When the system is being modified (deferred)").

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ShaunT
Posts: 8
Joined: Tue Jul 13, 2021 10:52 pm

Re: Problems running a Batch file.

Thu Jul 15, 2021 10:07 am

Hi Catalin,

Thank you for your response.

Does the attached look correct?

Just to add the application needs to install under a users profile who won't have admin rights.

I've attached my aip file - hopefully it'll help.

Thank you.
Attachments
Chronicall.aip
(96.41KiB)Downloaded 275 times
2Capture.PNG
2Capture.PNG (52.02KiB)Viewed 8305 times
Capture.PNG
Capture.PNG (47.7KiB)Viewed 8308 times

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Problems running a Batch file.

Thu Jul 15, 2021 2:20 pm

Hello,

The configuration does indeed look correct, with only one mention - you may want to disable the "Run under the LocalSystem account with full privileges (no impersonation)" option, since you have the "Run as administrator" option already checked.

The latter is usually used to elevate custom actions that can not directly be run as administrator. For instance, an inline PowerShell custom action, or an inline VBScript.

Please let me know if you have any other questions and I will gladly assist.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ShaunT
Posts: 8
Joined: Tue Jul 13, 2021 10:52 pm

Re: Problems running a Batch file.

Thu Jul 15, 2021 3:44 pm

Hi Catalina,

Tried unticking the "Run under the Localsystem account" option still getting the same error as before - please see attached.

Is there anything else I could attempt?
Attachments
Capture.PNG
Capture.PNG (23.76KiB)Viewed 8294 times

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Problems running a Batch file.

Thu Jul 15, 2021 3:54 pm

Hello,

Actually, please disregard my last answer, I somehow missed this part:
Just to add the application needs to install under a users profile who won't have admin rights.
According to our "Windows Installer Custom Actions" article:
For each of the deferred, rollback and commit actions you have an additional option: With no impersonation. This is related to the current user's rights set by the User Account Control (only for Windows Vista or above) when running the package. A normal user can run a custom action that requires administrator rights only if the “With no impersonation” option is set for it.
With that being said, please leave that option checked.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ShaunT
Posts: 8
Joined: Tue Jul 13, 2021 10:52 pm

Re: Problems running a Batch file.

Thu Jul 15, 2021 4:10 pm

Problem is if I leave that option ticked/unticked it still give's me the same error. :(

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Problems running a Batch file.

Thu Jul 15, 2021 5:36 pm

Hello,

That means the problem actually resides in your .BAT file.

Before implementing the custom action in Advanced Installer, please make sure it is working as expected outside of Advanced Installer.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ShaunT
Posts: 8
Joined: Tue Jul 13, 2021 10:52 pm

Re: Problems running a Batch file.

Fri Jul 16, 2021 10:03 am

Hi,

My batch file works fine within Windows , tested it in both cmd line and double clicked on it.

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Problems running a Batch file.

Fri Jul 16, 2021 2:05 pm

Hello,

In order for me to further investigate this, please forward me the following resources:

- a copy of the .AIP file

- a download link for the setup

- a step-by-step test case which I can follow in order to reproduce this

- some details about what the BAT file is supposed to do

by e-mail at support at advancedinstaller dot com.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”