Wednesday, September 22, 2010

Silent Installation and Uninstallation using setup.exe - Installshield

Silent installation and uninstall is a necessary requirement of automation process. In our organization we have a build dependency where one build is (c-sharp) dependent on installation of another build (C client build). Here we need to install a build package generated using installed silently and uninstall it once build completes.

Since InstallShield generated "setup.exe", there is an easy way to do silent installation. But I found the available solutions to silent uninstall is not working well for our product. Anyways I will give my findings.

Silent Installation
 - First create a InstallShield silent response file(setup.iss). This file will record the actions which we do while installing
      setup.exe -r
   It will create setup.iss file in Windows folder. i.e C:\WINNT in my case.
   Also you can use "-f1" option to create .iss file of your choice.
   For Ex: setup.exe -r -f1"C:\win32vc8\setup_inst.iss"
- Now Install with silent option (-s or /s)
   setup.exe -s
        or
   setup.exe -s -f1"C:\win32vc8\setup_inst.iss"
   If everything go well, then application will be installed and can be accessed from Program files.
- Trouble shooting errors
  Look setup.log file and make sure "ResultCode=0". By default setup.log file will be created at location where setup.exe is located. We can change this default location be providing alternative path with -f2 option.
  What various non-zero ResultCode value means?
   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


Interactive Uninstall from command line.
setup.exe /uninst

Silent Uninstall.  This is what worked for me.
Two ways
1) Using a Response File
   To run an uninstallation using a response file:
  1. Prepare a response file for the uninstallation (.iss) by running Setup.exe with the /r argument: Setup.exe /r
  2. Locate the Setup.iss file generated in the Windows folder and copy it to the desired location.
  3. Type the following at the command line (items in Italics represent data that is specific to your product's uninstallation): IDriver.exe /M{Your Product GUID} /s /f1"<FULLY qualified path>\YourResponseFile.iss"
Note: The /f1 parameter is necessary only if the Setup.iss file is located in a different directory than the Setup.exe file.

2) Simple Uninstallation
If you do not want to follow the script logic and want to uninstall the product, you can use the following command line:
IDriver.exe /M{Your Product GUID} /uninst
The /uninst parameter causes a forced uninstallation without opening the script. It rolls back the system changes made during the installation, including those from the MSI package and any InstallShield scripting.
Note: For both of these uninstallation options, the /M argument is case sensitive.
Note: By default, the file "IDriver.exe" is located in the following path: C:\Program Files\Common Files\InstallShield\Driver\\Intel 32.


 This approach silently removed the application entry from Windows registry ( regedit). But it didn't remove the installed files.

If you wish to create Response file manually, here is the link for instructions http://kb.flexerasoftware.com/doc/Helpnet/installshield12helplib/CreatetheResponseFile.htm

Wednesday, September 1, 2010

Error while starting hudson as a service on Windows

Error

Installing a service
[hudson] $ C:\hudson\hudson.exe install
WMI.WmiException: StatusServiceExists
   at WMI.WmiRoot.BaseHandler.CheckError(ManagementBaseObject result)
   at WMI.WmiRoot.ClassHandler.Invoke(Object proxy, MethodInfo method, Object[] args)
   at WMI.Win32ServicesProxy.Create(String , String , String , ServiceType , ErrorControl , StartMode , Boolean , String[] )
   at winsw.WrapperService.Run(String[] args)
   at winsw.WrapperService.Main(String[] args)

Few words about windows service

What is windows service?
it's a program that runs invisibly in the background. But can't the same thing be said for a number of programs that run in the background such as anti-virus programs. Yes, but the real difference is that services load and start running whether or not anyone logs into the computer, unlike a program that is launched from the Startup Folder under All Programs. 

Two ways to view Services
1) Typing msconfig.exe in the Run box accessed via the Start Menu, followed by clicking the Services tab. If you want a quick visual of which items are running or stopped, this is fine, but the information is limited. 
2) launch services.msc from the Run option on the Start Menu.


How To Delete A Service? 
  • Start | Run and type cmd in the Open: line. Click OK.
  • Type: sc delete service-name
  • Reboot the system
 How To Create A Service?
  • Start | Run and type cmd in the Open: line. Click OK.
  • Type: sc create service-name
  • Reboot the system