Tuesday, December 18, 2012

Writing custom strings to MSI Log File

Its a general practise to create a log file for troubleshooting installation related issues. By default installshield writes log file but it does not contain the logs related to our own created custom actions. We could write our own strings to the msi file by using SprintfMsiLog. 

For this we need to declare the prototype and defintion of our installscript code as below:

Custom action name: LoggingCustomAction

Code:
#include "ifx.h"
//prototype
export prototype LoggingCustomAction(HWND);

//custom action definition
function LoggingCustomAction(hLogInstall)
begin
    SprintfMsiLog("Writing Custom Log...");
    //return success to MSI
    return ERROR_SUCCESS;
end;


In order to be called, the custom action must be scheduled in the sequences. For this example, open the Custom Actions view and create an immediate-mode InstallScript custom action called callLoggingTest that calls the LoggingTestInstallScript function, and schedule it to run after LaunchConditions.

After building the package and running it with the /L*v switch, you should see a line similar to the following in the log file:
InstallShield 25:00:00: Invoking script function LoggingTestInstallScript
1: Calling LoggingTestInstallScript...

Wednesday, June 20, 2012

Change text in the Title bar of Installshield dialogs

IFX_SETUP_TITLE

This system variable contians the value to be displayed in the title bar of all the built-in dialogs (except dialogs generated directly by Windows API function calls) and all message boxes generated by the MessageBox function.

This system variable is automatically initialized to the value of the string entry TITLE_CAPTIONBAR, if that entry exists; if that entry does not exist, IFX_SETUP_TITLE is initialized with the following internal code:

Sprintf( IFX_SETUP_TITLE, SdLoadString( IDS_IFX_FORMAT_SETUP_TITLE ), IFX_PRODUCT_DISPLAY_NAME );

Changing the value of IFX_SETUP_TITLE automatically resets the title of all dialogs displayed by the setup.

Monday, May 28, 2012

Stop running processes

Hi,
Below is the code I had developed in C# for stopping the running processes on a user machine. This will be helpful while installing certain custom applications from installer.

 Process[] myProcesses;
// Returns array containing all instances of Notepad.
myProcesses = Process.GetProcessesByName("Notepad");
foreach(Process myProcess in myProcesses){
    myProcess.CloseMainWindow();

Thursday, March 1, 2012


Basics of MSI Log File


An MSI log file is a text file that provides a great deal of information about an installation program during a given run on a particular system, including:

  •  Final property values
  •  Startup information for actions
  •  Status, warning, and error messages


There are several ways to create an MSI log file, including:

1. Use the /L switch to msiexec.exe, as in this command:
msiexec /i product.msi /L*v Custom.log
The characters "*v" after the /L switch indicate to perform verbose logging of every
action taken by Windows Installer. The MSI help library describes the other switches
you can use to limit the information contained in a log file.

If your release settings include creation of a setup.exe launcher, you can use the MSI Command Line Arguments setting in the release properties to pass in the /L switch to msiexec.exe, with a value such as this:
/L*v "%TEMP%\everything.log"

Note that you cannot use MSI properties in the log-file path, as properties will not be
available until after the installation has initialized. The command above relies on the
command processor expanding the %TEMP% environment variable.

2. With MSI 4.0 on Windows Vista, you can set the MsiLogging property to a string
containing the logging flags you want to use. With InstallShield 2008, you can set this using the Create MSI Logs setting in the Product Properties view. The path to the log file will be stored in the MsiLogFileLocation property. 

Tuesday, February 21, 2012

Friday, January 20, 2012

Silently uninstalling previous version of product

Syntax:

1)   msiexec /x {PRODUCT_ID}

2)   msiexec.exe /i { PRODUCT_ID } /qn REMOVE=ALL

Commands helpful in accessing IIS 7.0

AppCmd.exe is a command which can be very helpful in accessing various types of information from IIS 7.0.

This exe resides in SYSTEM32\INETSRV directory on a local machine.

Some commands are:


appcmd list site "Default Web Site" /xml | appcmd list app /in /xml | appcmd list apppool /in /xml | appcmd recycle apppool /in
appcmd list app /site.name:"Default Web Site" /xml | appcmd list apppool /in /xml | appcmd recycle apppool /in


I will describe the purpose of these commands soon...