Command Line Installations
Triggering unattended application installation from the command line.
The surest way to deploy an application with the least amount of issues is to use the setup routine designed for the application in the first place. Repackaging is necessary when a using a deployment tool that requires it, or when a command line installation is not supported. Often poorly documented, or not at all, you may find it difficult to discover how to go about this. You may also be surprised at the number of ways that exist to silently install an application from the command line when you know where to look and what to try. By "from the command line" we are talking about the use of command line switches to initiate the unattended installation of software such as "SETUP.EXE /SILENT". There are a number of steps you can take in your attempt to uncover a means of command line installation and we will cover them all here. As always, if you know of something over looked, shared in the comments below!
- Check Your Resources: Places To Look
- Windows Installer Setups
- Built In Command Line Support
- Troubleshooting Your Command Line Installation
Check Your Resources: Places To Look
It is the goal of ITNinja to be the best place to start your search for any information relating to deployment. This especially includes how to deploy various applications. In working toward this goal ITNinja offers a Software Knowledge Base. This feature of our site provides consolidated details on the deployment of specific applications. We also have a well used Q&A feature here where you can ask others for help, or just see if another visitor has already addressed your question.
Included Product Documentation
In the form of a README.TXT or other included document you may get lucky and find the information you need. Unfortunately, vendors make it difficult if not impossible to scrape together any help by very often overlooking the issue of remote deployment altogether. Still, to expend efforts trying to uncover information that may have been provided to you up front is certainly not the best use of your time. Take a look- you may be fortunate enough to have the answer right in your hands.
Many vendors now provide a knowledge base and user forums at their websites. This is an excellent source for finding silent installation information. You are unlikely to find much information in a FAQ, but there may be a knowledge base article covering the topic. The most likely place though, is the user forums or message boards where another user has come before you in search of the same information.
SMS Package Definition File (PDF)
No matter if you are using SMS or not, a Package Definition File is a great source of command line options if your software happens to include one.
PDF files are actually INI files, which may be viewed with a simple text editor such as notepad. Look for the "COMMANDLINE" entries in the file for unattended installation command lines. Many older Microsoft applications include PDF files and there have been a number of other software companies that had deployment of their applications in mind and also provided a PDF. For more information on PDF files check here.
Windows Installer (MSI) Setups
Microsoft's new Windows Installer format is the latest answer to solving issues with installation, removal and, yes, deployment of applications. A Windows Installer based installation is currently a logo requirement for Windows 2000 (and later) compatibility. This means more and more applications are surfacing as MSI installations. You are still likely to see a "setup.exe" so don't stop looking when you see it. A program named setup.exe is still often included as a wrapper for the Windows Installer installation, which checks for the existence or for the installed version of the Windows Installer service. If it is missing or out of date, the setup.exe will install or update the service before triggering the Windows Installer installation process. Do a search of your installation media for a file with a "MSI" extension to be certain. When found your command line installation just became one of the best documented of its kind:
I recommend the following command line for the silent installation of MSI setups:
MSIEXEC.EXE /I "path and filename of MSI" /QB- /LWAMOE c:\temp\install.log ALLUSERS=1
- MSIEXEC.EXE - the MSI executable, the program that performs the actual installation of the application.
- /I - this switch informs the Windows Installer to install the specified application (as opposed to removing, reinstalling or repairing the application)
- /QB- - this switch instructs the Windows Installer to perform the installation with a basic user interface requiring no dialog boxes to be displayed. You might also use /QN to perform the installation with no user interface at all.
- /LWAMOE c:\temp\install.log - this switch instructs the Windows Installer to generate a log file at the specified path and file name (in this case, "c:\temp\install.log") and to include the following details: Non fatal errors, start up actions, out of memory or fatal exit information, out of disk space messages and all error messages. There are several other options (see the AppDeploy FAQ for more details) to include all possible details in the log file use "/L* c:\temp\install.log"
- ALLUSERS=1 - including this will cause the shortcuts for the application to be placed in "all users" instead of the current user profile.
See the Windows Installer (MSI) tag for more information.
If your installation is not a Windows Installer setup and no specific information can be uncovered regarding a means of silent installation, you may still have a very good alternative. If the setup.exe was created with an InstallSheild authoring program, a number of command line switches are supported by the setup that may help you to deploy it.
Integral is the ability to create an answer file and then use that answer file to perform the silent installation of the application. It does not always work just the way you would like, and keep in mind that the vendor may not even be aware of this ability they have provided. However, it often works just fine and should be pursued as a means of deployment before resorting to repackaging the application.
Create an answer file by launching the setup with the "/r" switch. This will take you through the normal series of dialogs to the completed installation of the application. When done, simply copy the "setup.iss" file created in your system directory (normally, c:\winnt\setup.iss) and place it in a folder along with the application's other installation files. This folder is often a copy of the installation CD on a network share, but the end result should be that you have your created setup.iss file and the application's setup.exe file in the same folder.
To kick off the silent installation of the application you may now simply specify the "/s" switch to make use of the answer file you have created. During installation there will be no prompts or indications the installation is taking place or complete. View the Windows Task Manager to see the process activity if you are interested.
You can view the setup.iss file in a simple text editor such as notepad to see what was recorded in the answer file. If serial number information was requested during installation, you will hopefully see it reflected here. This is most often the point of failure for use of an answer file such as this. If the capture of your responses does not include the serial number information, or any information for that matter, the installation may hang, fail or a pop up dialog may be presented requesting missing information. For this reason through testing should be performed (as always.)
See our full listing of InstallShield command line switches for more detail.
Troubleshooting Your Command Line Installation
Nothing happens at all? If you are watching the task manager processes and do not even see your setup initiating, your call to it is in error. Make sure all files referenced are where you are specifying them to be. If you are not specifying a path, that too can be your problem. In a batch file for instance, the current directory may reset to the system directory where your installation files can no longer be found. To ensure this is not your problem, specify the entire path to all files referenced (when spaces are involved in directory or file names, be sure to include them in double quotes.)
If something goes wrong during installation, you may see the dialog with the progress bar moving in reverse. This means an error was encountered and the Windows Installer is putting everything back the way it was to avoid problems. You can easily see what the problem is by viewing the log file created by the Windows Installer (see recommended command line above with /L switch)
If you see your setup start in the Windows Task Manager (processes tab) and it remains while utilizing zero CPU cycles- you have a problem. Likely there is a dialog response not being provided by the answer file and due to the lack of a display, you cannot see where the problem lies. For more switches you can use in troubleshooting, check here.
No SETUP.ISS file is generated? First make sure you are dealing with an InstallShield setup. Some vendors have been known to wrap their setup programs in self-extracting archives. If you believe this to be the case for your situation, initiate the installation and at the first dialog prompt change windows (do not abort the installation) and browse to the TEMP directory (by default this is in your profile directory "C:\Documents and Settings\username\Local Settings\Temp" for Windows 2000 and later). Here you may find a temporary directory generated that contains the actual installation files. You may then copy the installation files from this directory elsewhere (it is removed when the setup is completed or aborted.) The copy of setup.exe found here is very likely to support the process documented above (if it is an InstallShield setup and not an MSI setup or other vendor generated setup program.)
Check the log file generated in the setup.exe directory for its [ResponseResult] section. InstallShield places one of the following return values after the ResultCode keyname:0 Success.
-1 General error.
-2 Invalid mode.
-3 Required data not found in the Setup.iss file.
-4 Not enough memory available.
-5 File does not exist.
-6 Cannot write to the response file.
-7 Unable to write to the log file.
-8 Invalid path to the InstallShield Silent response file.
-9 Not a valid list type (string or number).
-10 Data type is invalid.
-11 Unknown error during setup.
-12 Dialogs are out of order.
-51 Cannot create the specified folder.
-52 Cannot access the specified file or folder.
-53 Invalid option selected.
Still No Luck?
Perhaps there is some undocumented process you can uncover. Below are some command lines found to work for other applications in the past, try "setup.exe /?" first then go through the list below- you may get lucky!
- setup.exe /q
- setup.exe /qn
- setup.exe /silent
- setup.exe /s
- setup.exe /NoUserInput
- setup.exe /unattended
- setup.exe /CreateAnswerFile
- setup.exe /quiet
Please use our Q&A system to discuss these and other issues regarding the deployment of specific applications and deployment in general. Here the maximum number of experienced desktop engineers will have an opportunity to respond and all may benefit from it.
Bob Kelly 9/23/01, Updated for ITNinja references/links on 11/8/12