Automated Windows Installer Properties from .INI (Embedded VBScript)

Download: [download#2#size#nohits]

Have you ever needed the functionality to read the property values from an .ini file, every time a installation or repair is run?

This small script created for Windows installer, will do the job.

Purpose:  

Automatically reads a ini file located in the MSI SOURCEDIR property.
Each parameter in the ini file is read into the property that
have the same name.
ex. “DaysSerial”=”0100000” line is read in to property named
DaysSerial and setting the value to 0100000
System works both with “DaysSerial”=”0100000” ini format, or DaysSerial=0100000 ini format.

If you later change the ini file at the source, and do a repair of the msi on the client, the new settings will be used.

NB! I also tried to make a script that could use custom named ini file, based on the commandline parameters, but it is, as far as i know, not possible. If you have an idea of how to do it, please do not hesistate to comments this article.

The problem is that if you later do a repair on the package, it will use the default settings, instead of the custom named ini file. This is why i “hardcoded” the ini filename into the package.

Usage:  

Put into MSI package execute deferred after “InstallInitialize” and
“ResolveSource” actions. In this example i have used VBScript Embedded.
NB! You might have to insert the “ResolveSource” action, since it is not allways default.

image

Script:

Warning: 

This script was tested in a msi package created by Visual Studio 2008
and edited in Wise Package Studio.
Coretech A/S is not responsible for any damages the script could cause.

 

About the Author:

Jakob Gottlieb Svendsen

Twitter: @JakobGSvendsen

Jakob Gottlieb Svendsen is a Microsoft Cloud and Data Center Management MVP (http://mvp.microsoft.com/en-us/default.aspx), Working as Global Lead Developer, Senior Consultant and Trainer at CTGlobal, where he is one of the driving forces in keeping CTGlobal a System Center Gold Partner and member of the System Center Alliance.

Since he started at Coretech in 2007, he has focused on Scripting and Development, primarily developing tools, extensions and scripts for the System Center Suite. His main area is Automation (including OMS/Azure Automation, Service Management Automation, PowerShell and Orchestrator). Another area is Windows Azure Pack / Azure Stack, where he does implementation, development, workshops and presentations. He is a world-wide renowned voice in the Automation field.

He is passionately devoted to the community, to which he contributes by being a moderator at TechNet and sharing his knowledge at http://blog.ctglobalservices.com/jgs

  • Co-founder: PowerShell User Group Denmark
  • Speaker at MMS 2016, Minneapolis (www.mmsmoa.com)
  • SCU Europe 2014, 2015, 2016 (www.systemcenteruniverse.ch)
  • Microsoft TechEd North America 2014, Houston
  • NIC 2012,2013,2014,2015, Oslo (www.nic.com)
  • Microsoft CampusDays 2011, 2013, Copenhagen
  • Microsoft TechDays 2015, Sweden (www.techdays.se)
  • Microsoft Partner Event: New in SC2012 SP1
  • User group meetings (PSUG.DK , SCUG.DK/BE/NO, AZMUG + more)
  • Microsoft Certified Trainer.
  • Microsoft Scripting Guys Forum Moderator

Main working areas:

  • Automation (Azure Automation, SMA, SCO)
  • Windows Azure Pack / Azure Stack
  • System CenterVisual Studio Team Services / Team Foundation Server
  • Development:C#.Net, VB.NET, VBScript, PowerShell, Service Manager, OpsMgr, ConfigMgr
  • Orchestrator
  • Windows Azure Pack / Azure Stack

Training:

  • Azure Automation
  • Service Management Automation
  • System Center Orchestrator
  • PowerShell, VBScript, C#.Net, VB.Net
  • Windows Azure Pack / Azure Stack Development Workshops

11 Comments

  1. Wim October 23, 2008 at 14:38 - Reply

    yES THANK YOU

  2. Elwin March 26, 2009 at 10:37 - Reply

    Great script! Exactly what I was looking for.
    The only problem is the download doesn’t work.
    A error 404 occures with the following text:

    Fatal error: Cannot use object of type WP_Error as array in D:xampphtdocsblogwp-contentthemescoretechsidebar.php on line 52

  3. Jakob Gottlieb Svendsen
    Jakob Gottlieb Svendsen March 26, 2009 at 10:44 - Reply

    Hello Elwin!

    Thank you.

    I am sorry that you could not download.
    We have recently updated our blog system.
    The error is fixed now, and the download should work.
    Thank you notifying us about the error.

    Have a nice day

  4. Elwin April 10, 2009 at 11:07 - Reply

    Thanks!
    The download is working now.

    I’m quite new to VB2008 and I don’t understand how to make the script working.
    I have made a office addin and created a Deployment Project.
    The script is added to the Deployment Project.

    I don’t understand the Usage part of your description.
    Where do I find “InstallInitialize” and “ResolveSource”?

    Thanks in advance.

  5. Jakob Gottlieb Svendsen
    Jakob Gottlieb Svendsen April 20, 2009 at 15:02 - Reply

    Hello Elwin,

    I am sorry for the late reply.

    I dont think you can edit the script part of the MSI Package in visual studio!

    That is why i had to edit it in Wise Package Studio.
    You might be able to put the script into Custom Actions in Visual Studio, but i am not sure how.

    I always use Wise Package Studio for creating and editing packages, it has many more functions than Visual Studio.
    The only time i use VS for MSI packages, is when i am creating an installer for my own projects.

    – Jakob

  6. keen March 5, 2010 at 7:58 - Reply

    Hi,I want to study vbscript for using QTP, but i have not enough resoruce that help a beginner to study it. so can you recommend some information to me.
    Thanks.

  7. keen March 5, 2010 at 8:03 - Reply

    in my country, the resource about vbscript is very exility.
    help me pls.
    send some information to my email.

  8. vbscript code March 30, 2010 at 6:04 - Reply

    […] upon the need to determine the dimensions of some images. Because the script was being written inAutomated Windows Installer Properties from .INI (Embedded …Download: Have you ever needed the functionality to read the property values from an .ini file, […]

  9. john November 22, 2011 at 8:08 - Reply

    um this is nice but why re architect something that already is working fine out of the box.

    appSearch has this capability already.

  10. seo Carlsbad June 8, 2013 at 0:05 - Reply

    Very nice article. I definitely love this website.
    Stick with it!

Leave A Comment