PDA

View Full Version : Run setup.exe in silent mode and provide responses to dialogs



Svetlana
01-08-2010, 09:43 AM
Hello,

I can't seem to find this information in the documentation and forums. I have a SetupBuilder installer that needs to run in silent mode. Using the setup.exe /S switch works but it just runs through the installer with all the default selections. I need to be able to provide different responses in some of the dialogs, such as server name and DB name.

In InstallShield, this is achieved by using the -r switch to run the installer in "recording" mode which creates a setup.iss response file to use in subsequent silent installations. Is there similar functionality in SetupBuilder?

Thanks in advance,

Svetlana

linder
01-09-2010, 02:48 AM
Svetlana,

You have several different options. For example, you can use the command line interface to set runtime variables.

Let us assume, you have a %SERVER_NAME% runtime variable which holds the name of the server.

The command line to set the server name would look like this:

setup.exe /V SERVER_NAME "This_is_the_server_name"

Or, if you would like to use a "response file", you can use the "Get INI Value..." function to read all your stuff from a file.

I have developed and uploaded a source code demo for you:

http://www.lindersoft.com/projects/response_file_demo.zip

Does this help?

Friedrich

Svetlana
01-11-2010, 11:11 AM
Hi Friedrich,

Thank you for your prompt reply and the code sample. I think for our purposes here, the command line option will be more convenient. I will try that and post an update when possible.

Svetlana

Svetlana
01-11-2010, 01:04 PM
Hello Friedrich,

Thanks again for your reply. I tried the suggested command line switch, however, it does not produce the desired result and I could not find any logs to help me troubleshoot what went wrong. Is the /E switch supposed to enable logging in the Application Event Log?

This is the command I used, from a windows batch file:

call "C:\Setup\MySetup.exe" /S /V W_DSERVER "MyServer" W_DBNAME "MyDB" /E

I need to set two runtime variables, is this the correct syntax for passing the two values? I also tried /V W_DSERVER "MyServer" /V W_DBNAME "MyDB" with the same result. The installer screens are all displaying in the correct order and it appears to be running database scripts, but apparently not on the correct database.

Thanks,

Svetlana

linder
01-12-2010, 01:19 PM
call "C:\Setup\MySetup.exe" /S /V W_DSERVER "MyServer" W_DBNAME "MyDB" /E

It should be:

C:\Setup\MySetup.exe" /S /V W_DSERVER "MyServer" /V W_DBNAME "MyDB"

You can send us your project file and we'll check your script (I assume you have a problem in your script logic).

Friedrich

Svetlana
01-12-2010, 03:41 PM
Hi Friedrich,

I tried removing the /E switch and using two /V switches as you suggested but still no improvement.

I would rather not send the .sb7 project due to intellectual property issues (we use it in production.) One thing I noticed today is the installer normally creates logs for the database upgrade but it didn't create them this time. It did unpack the sql scripts correctly to the hard drive but apparently did not run them at all.

I will try adding some more error logging to the script and troubleshoot from there. Thanks for your suggestions.

linder
01-13-2010, 12:25 AM
Hello,

No problem. If you are interested, you can create and send us a simple demo .sb7 project that reproduces this problem and we'll fix it in that project for you so you can see how this works.

Our support email address is support [at] lindersoft [dot] com.

Friedrich

linder
01-13-2010, 04:48 AM
Svetlana,

We have developed and uploaded another example for you.

http://www.lindersoft.com/projects/ctest.zip

Unzip to a temporary folder and run the cbatch.bat batch file. It will execute the ctest.exe and then pass the following to the application:

ctest.exe /S /V W_DSERVER "MyServer" /V W_DBNAME "MyDB"

The ctest.exe will display the variable values.

Does this help?

Friedrich

Svetlana
01-27-2010, 01:23 PM
Hello Friedrich,

That was very helpful, thank you!

I added the message box as you suggested and all the variables are being displayed with the correct values. However, the silent install is still not going through.

After tinkering with this for a while, the only possibility I can think of is that the EULA dialog is breaking the silent install because we have the "I do not accept" option pre-selected. We do not explicitly mention this dialog in the script so I'm not sure how the silent installation handles it but I would assume it takes the default "I do not accept" value so the code after that point is simply not executed.

So I would need something like this:

If %_SB_DIALOGID% Equals "$DLG_EULA$" And %_SB_INSTALLERFLAG%Equals "1" on Position "$SB_SILENTMODEFLAG$" Then
Set Variable %MY_VARIABLE% to "I accept"

I am not sure what the variable name and value should be in the above example. Is there a way to expose the code for the EULA dialog? All I have been able to access is the GUI editor under Setup Appearance - Dialogs. It seems the EULA dialog does not have the "Store selection in variable" capability of the standard Radio Button dialog. So if I am not mistaken, in order to use the code above, I would need to rewrite our License agreement dialog to use the Radio Button template rather than the EULA. Does that make sense?

Thanks in advance,

Svetlana

linder
01-28-2010, 04:14 AM
Svetlana,

What about this solution (see attached screenshot) ;) If it is running in silent mode, the License Agreement dialog is not displayed.

Friedrich

Svetlana
01-28-2010, 07:09 AM
Perfect, I will try that, thanks!

Svetlana
01-28-2010, 09:37 AM
Tried this but it's still not working in silent mode. There is only one other dialog with a user supplied value, but that is already being initialized to the value we need so it should not be an issue. I'm not sure what else to try at this point. :confused:

linder
01-28-2010, 10:13 AM
Because you can't send us the project (you told in a previous message that "due to intellectual property issues" you can't provide us with the .sb7), I am running out of ideas. The problem is that I can only guess what you are doing. It's definitely caused by your code, but I don't know what you are doing, so I can't tell you what you are doing wrong <g> ;)

But if you create a simple "dummy" script that has the same behaviour, you can send us this demo and we can tell you what you are doing wrong.

Friedrich

Svetlana
01-28-2010, 12:04 PM
Please see the attached DemoInstaller.zip for the .sb7 script. Thanks for all your help!

Svetlana

linder
01-29-2010, 08:59 AM
Svetlana,

We reviewed your script. I think we know what your problem is. Please note that the "Wizard Loop" is NOT executed at all in a silent mode install! But you are doing a lot of stuff in this first "Wizard Loop" function and this code is never executed because the dialogs are not displayed ;)

Does this help?

Friedrich

Svetlana
02-01-2010, 03:34 PM
Thanks Friedrich!!

That was the answer. After pulling the "run program" statement outside of the Wizard Loop, I finally had a successful silent install.

If this could be more fully documented in the Help - something that states the Wizard Loop is not executed at all during a silent installation - it would help others avoid the same kind of headaches.

Thanks again,

Svetlana

linder
02-02-2010, 02:03 AM
Svetlana,

Well, the following is from the help file ;)

Loop Wizard documentation:

Remarks

All code within a Loop Wizard structure is not executed when running in silent mode!

Friedrich

Svetlana
02-12-2010, 02:18 PM
True, but this topic did not come up when searching the Help for "silent install". I did not know enough to look up the Loop Wizard documentation.