How to input parameters into the downloaded setup.exe on the server side? - installation

What methods exist to include parameters (such as userid) into the setup.exe that users download from a server?
I'm looking for a way to give a customized installer to users that I already know (because they are logged in).

Is your question tied with some technology/installation system? Or you are researching which installation system to use to achieve this functionality?
In NSIS there is option to append custom data to installer, see this article: http://nsis.sourceforge.net/ReadCustomerData.

Maybe the easiest would be to send a setup_whateverparameter.exe filename instead of setup.exe...
A smarter approach would probably be to store parameter into a ressource file which would be edited from command line with some tool like http://www.reseditor.com/
Another one would be to generate a sort of INI file which would be packed with the original setup file using some installer software like Inno Setup (http://www.jrsoftware.org/isinfo.php) and the original installer would be configured to check if some ini file exists in a temporary location, to just use its content to do specific tasks.
Other possibilities might exists, thoses are just the one which might be the most easy to implement.

#elfrancesco hinted at Ninite and Patrick from Ninite got back to me with:
We put the installer id in a segment of the .exe that doesn't get
included in the hash for the signature. So we just sign our loader
.exe once whenever we update it and then our web server drops in the
key for each download.

Related

Simplest way to distribute software to customer?

I have a software business and currently send a zip file with a setup.exe file to the customer. The problem is many don't even know how to unzip the file. If I try to sent the setup.exe file directly they get all kinds of warnings that it could be harmful.
What is the best way to handle this?
Get a code signing certificate and have them download the setup.exe directly from my server.
Make an msi file.
Another method?
I feel like this should be really simple but I can't find much online about an easy way to do this.
I think it is best to use Installshield or NSIS as an alternative solution.
Otherwise, it would be better to create either exe file or msi file and inform your customers that it is okay to launch trusted software whose extension is exe or msi.

How to make WIX create files to Program Files folder in the installation? I have "Access defined"

I am creating a WIX installer project. During one managed customized action, I need to create a file (other than the deployed files specified in the components of WIX) in the installation folder, which by default is the Program Files folder. I am experiencing the "Access denied" problem in Windows 7. After some searching, I found out that people say it is not advisable to create files into Program Files folder. Instead, try to create files into for example AppData folder. For example, see this link:
C# Access denied to path in a Windows Application
But my question is, the generated file is crucial to our SW, so it must reside in the installation folder. Isn't it the target of SW installation, I mean, to create file in most of the cases Program Files folder? Does it mean the only files should be added into installation folder, during the installation, are the deployed files (basically the targets of XCopy)?
My file can't be made deploy-able in the WIX, i.e, it can't be made ready before the installation. So what's the proper way or best practice to handle such situation: a file must be generated during the installation, into the installation folder. It is not some log file that I can put somewhere else. I tried to create a Permission element in WIX for the INSTALLADIR, although it seems to be against the rule mentioned in the link, but it still failed. Thanks!
UPDATE:
Based one MichaelUrman's commen, some more information. The generated file is needed after the SW is installed and necessary during normal launch of the SW. And I think it needs to be modified during normal use after the installation. And as I mentioned my a comment to #caveman_dick answer, my CA is actually in commit phase, I don't know whether there is any difference between it and normal deferred CA
Set the custom action to Execute="deferred", that will run the command elevated and should give it the required permissions to create the file.
Since you need to update that file from the main application, and I'm assuming your application does not require elevated privileges, you have three options.
The first is the worst: without a manifest, your executable's attempts to write to the Program Files folder will typically result in it being redirected to the Virtual Store (see File Virtualization). It sounds like this isn't happening in your case, so you can't use it.
The second option is to modify the application to store this in an appropriate location such as the ProgramData folder, or Common Documents, or (if appropriate) a per-user location under LocalAppData. This is typically the best approach, but has the highest development costs.
Finally the third option is to create the file and change its permissions (or in some cases to change the permissions on the folder containing the file), allowing limited users to modify this file. See LockPermissions or MsiLockPermissionsEx for the Windows Installer way to approach this. Change the permissions on as few files or folders, as restricted as possible, to keep the system as safe as possible if you go with this option.

What is the correct way of customizing an installer

My scenario is as follows:
I have a client-server application. The client is deployed through an MSI package. I would like to customize the MSI to include some details that are specific for the each installation (i.e. I need to write the address of the server into one of my configuration files; this address is different in each installation).
I am considering the following alternatives:
Unpack MSI, un-compress CAB, modify file, compress CAB, create MSI (as explained in this link). The problem is that I need this to be done automatically (no GUI, no user intervention)
Pass the address as a parameter to the MSI. Then during the installation read this parameter and modify the file. This is far less desirable since creating the configuration file on the client is something that I am not currently doing, and this means adding another component to the client.
Create the MSI from scratch on the server.
If someone has experience doing something similar, I would appreciate the feedback.
What are you using to author your installer? I know WiX and InstallShield both have custom actions designed to update XML files using XPath statements. You can do things like
For Foo.Exe.Config
//appSettings/Add[#key="Server"] set Value = "[SERVERNAMEPROPERTY]"
Then you could write a custom dialog that asks the user for the value to set the property. You can also do silent installs with:
msiexec /i foo.msi /qn SERVERNAMEPROPERTY=MyServerName

Is it possible to detect if help file is contained in the setup file (msi or exe)?

I would like to know how can I detect if help file is contained in setup file for windows platform application (msi or exe). Is there any method to get this information without installing the software first ?
Of course setup file can be created by many setup makers like innosetup, installshield and so on. So I wonder if there is some universal method to solve this.
For an MSI based install it would be very easy. For example you can use the Microsoft.Deployment.WindowsInstaller interop via C# to open the MSI as an InstallPackageClass then access it's Files collection to see if it contains the file you care about.
For a Non-MSI based install, there is no universal way and in most cases, no way period. See, that's kind of the point of MSI: to have a standards based package rich in meta data to be able to see what it's doing. When you do some proprietary script driven installer you lose that openness.
If it's a MSI file, open it up using Orca, and you can view file names.
For both of them, you should be able to do an administrative install, which would extract the files, but not register anything. Depending on where the exe came from, doing an administrative install changes, since each vendor(installshield, innosetup, etc) has their own way to run an administrative install.
for a MSI it's simply
msiexec /a <msi_filename>
For an exe you'll have to look up how to pass the /a argument.

Freeware tool for creating a single file installer from an msi file + config file (thats easy enough for an End-User to use)

My installer requires there be two files in the same directory in order for it to install.
The installer (.msi file)
An organization specific config file that the installer copies. (This file is customized by the organization and then distributed to it's end users).
Since there are two files, the file has to be distributed as a zip file. Which presents the issue of if a user tries running the .msi without actually extracting the zip... only the msi file gets extracted. I am able to detect the issue in the install process and tell the user they need to unzip the file... but you know how noone actually reads error messages.
So, I'd like to make it more foolproof and so i was wondering if there was a simple tool that i could let my customers (ie the organization) be able to make modifications to the config file and when finished create a .exe file which when clicked would extract to a temp folder and then run the msi. I know there are solutions for this which require commercial software. I'm wondering if a simple freeware tool exists that can do this.
Edit: Accepted Solution Notes:
The one issue i ran into is the iexpress wasn't designed to be used for .msi files. As a result on the step that asks you for the Install Program. It's a combo box which if you had added a .exe file in the previous step could just select the .exe file from. Instead you have to manually type in
msiexec /i yourinstaller.msi
I was very pleased to find such a simple solution that's built in to windows. The only way this could be better is if it allowed for wildcards so that your iexpress project would be able to handle changes in the msi file's name which occur with each version. And defaulting the Install Program to the .msi file. These minor inconveniences are offset by the fact that end user wouldn't need to install any new software to create the package so I have stopped looking for other tools.
You could try using iexpress.
It enables you to package up a set of files which can be extracted, with the option of running an installation command automatically after extraction. It also has options to enable you to prompt users about things, show a EULA, restart the computer, etc..
I believe it comes as part of Windows (part of IE?) - try running iexpress.exe from the run dialog to get the UI.
The Wix project has a bootstrapper and packager for dealing with this kind of thing.
I've used wix a lot but haven't really looked at the bootstrapper/packager much - last time I had a quick look it wasn't really usable but that was a long time ago so it may be better now.
I'm guessing that the config file is something like a properties file, and that you want users to set the values of the properties "foo" and "bar". You don't need a separate tool to update the file.
I would do this:
Put one or more dialogs in the install that ask the user what the values of foo and bar should be, and set a couple public properties accordingly.
Write a custom action that writes the config file out to whatever location you want, including whatever values you want for foo and bar. This would be pretty easy in vbscript.
Put the custom action somewhere in the execute sequence (ideally as a deferred execution action, since you're making changes to the system).
Add an entry to the RemoveFile table, so the config file is removed on uninstall (assuming you don't want it to be left behind.)
Add an entry to the LaunchCondition table, to prevent users from doing a silent install. Or if you want silent install to be allowed, make the names of the public properties that hold the config data known, and make them part of the LaunchCondition. You would block "msiexec /i myapp.msi", but you could choose to allow "msiexec /i myapp.msi FOO=Something BAR=SomethingElse".

Resources