powershellautomationinstallshieldpowershell-4.0installscript-msi

How to update the folder name in InstallShield project for Registry section by Powershell?


enter image description here

I have the powershell script which updates the product name, version, Product code, shortcut name etc of the installer.

But i don’t know how to update the name of a particular folder which is created under Registry section which itself is present under System Configuration section of a InstallScript MSI project in InstallShield 2015.

The sequence of folder is in this form - HKEY_LOCAL_MACHINE\SOFTWARE\Demo\12.1.0.0

I want the 12.1.0.0 folder value to be updated to 13.1.0.0 by using InstallShield Automation Features.

Any help on this issue would be appreciated.


Solution

  • I assume you are automating the generation of a new product version as part of a build system using COM automation? For a second I was wondering if you were poking around directly in the registry after installation. I assume it is COM automation.

    I have experienced some "clunk" with the Installshield object model - just so you are warned. Here is a sample for how to automate the creation of a new build / release using COM automation and VBScript: How to change product code programmatically (for reference, you already have this by the looks of it). I had problems with the save function after building. It might be something I messed up.

    Rather than deleting and adding components, I would simplify this by making a new component that is "universal" and "reusable" by using the [ProductVersion] property instead of hard coding the product version (give the component a new GUID when and if you make this change since the key path will move).

    enter image description here

    This means your component will write this to the registry: HKLM\Software\Demo\[ProductVersion]. This will be a "moving target" as you compile new versions of your application (key path will change). Because of this you should generate a new GUID for the component on each build. This is easy via automation (much easier and more reliable than adding and deleting components which will be prone to runtime errors and exceptions in my experience):

    ' This is for Installshield 2018 - change 24 to 23, 22, etc... depending on IS version
    Set isproject = CreateObject("ISWiAuto24.ISWiProject")
    isproject.OpenProject "C:\InstallShield 2018 Projects\My Project Name-6.ism", False
    
    ' Retrieve existing component and assign a new GUID. Should be all that is needed?
    Set mycomponent = isproject.ISWiComponents.Item("NewComponent1")
    mycomponent.Guid = isproject.GenerateGUID()
    
    isproject.SaveProject
    isproject.CloseProject
    

    You have to exercise care as to what you write to the registry with this component (it should overwrite all on reinstall / upgrade since the key path moves). Write only static settings - settings that are not required to be modified by the application. And I would be very careful with any license keys (could be reset on repair, self-repair and update).

    The moral of the story: always test all installation modes: install, uninstall, repair, modify, self-repair, patching, major upgrade, minor upgrade, etc...


    Please also note that Installscript MSI projects are known to be buggy, and frankly I do not recommend their use at all. In my experience they are particularly hard to upgrade properly. Use Basic MSI instead for a much better setup experience. It is significantly better for corporate deployment. Corporate application packagers let out a deep sigh when they get an Installscript MSI to deal with. Just the truth I am afraid (it is the problematic silent running that is the main issue, and various other problems).


    UPDATE: One should change component GUID whenever a component's key path has changed (the absolute installation path). This answer tries to provide a better explanation why this is technically necessary: Change my component GUID in wix?