Wise Package Studio Custom Action vbscript XML

Posted on 2011-05-10
Last Modified: 2012-05-11

I'd like to create a custom action which reads an external .XML file.  Let's say I have 100 registry keys and want to populate them upon uninstall.  I want these keys outside of my MSI because I'd like to be able to update them without having to recompile the .MSI.  Has anyone worked with something like this before?

Question by:Paraleptropy
    LVL 12

    Expert Comment

    Please can you post the XML file, or dummy data that is representative of it?

    Also if the external file just contains details of the registry entries to write, does it need to be in XML format?  Could it not be in standard .reg format?


    Author Comment

    I'm looking for something more dynamic.  I have another way of doing this already.  I'm reading values using Winbatch out of a .ini file.  I'm exploring new ways of regionalization and someone mentioned the .XML format.  Figured I'd give it a shot.

    <?xml version='1.0'?>
    <Wix xmlns=''>
       <Product Id='{929E7AB8-2E59-4C9B-B15A-C89D1E7BFC47}' Name='My package.msi' Language='1033' 
                Version='' Manufacturer='Microsoft Corporation' UpgradeCode="{5381834C-1044-47B0-A6D7-B93B5974B2F4}">
          <Package Description='My Package'
                   Comments='TEST INSTALL'
                   Manufacturer='Microsoft Corporation' InstallerVersion='200' Compressed='yes' />
    <Feature Id='Features' Title='Features' Level='1'>
     <ComponentRef Id='Registry' />
    <Directory Id='TARGETDIR' Name='SourceDir'>
         <Component Id="Registry" Guid="{387A0463-20A4-4FEB-8070-A00C43C304E2}">
                    <RegistryValue Id="registry506" Root="HKLM" Key="SOFTWARE\PRC\Chinese_Food" Name="General Tsao" Value="Combo" Type="string"/>
                    <RegistryValue Id="registry589" Root="HKLM" Key="SOFTWARE\ODBC\ODBC.INI\BOB" Name="Driver" Value="[SystemFolder]SQLSRV32.dll" Type="string"/>
                    <RegistryValue Id="registry590" Root="HKLM" Key="SOFTWARE\ODBC\ODBC.INI\BOB" Name="Description" Value="Restarea1" Type="string"/>
                    <RegistryValue Id="registry591" Root="HKLM" Key="SOFTWARE\ODBC\ODBC.INI\BOB" Name="Server" Value="Restaraunt" Type="string"/>
                    <RegistryValue Id="registry592" Root="HKLM" Key="SOFTWARE\ODBC\ODBC.INI\BOB" Name="Database" Value="buffet" Type="string"/>
                    <RegistryValue Id="registry593" Root="HKLM" Key="SOFTWARE\ODBC\ODBC.INI\BOB" Name="Language" Value="us_english" Type="string"/>
                    <RegistryValue Id="registry594" Root="HKLM" Key="SOFTWARE\ODBC\ODBC.INI\BOB" Name="LastUser" Value="SYSTEM" Type="string"/>

    Open in new window

    The problem with this code is that it's not regionalized.  When I say regionalized I mean that people in NY will get one set of keys, people in LA will get another set, people in Singapore will get another set,  etc...  Of course I'd like for this to maybe populate more than just the registry, maybe other system settings as well.

    Looking forward to ideas and input.  

    Thank You!
    LVL 12

    Accepted Solution

    I think that due to the complexity, you might be better off writing the routine in WinBatch, especially if you are already quite expert in it (this might help: and then include the compiled EXE in the MSI package.

    You could then create a custom action (Execute Program from Installed Files) and pass it as an argument the path of the msi itself and open the XML file from the same folder of the msi (use [SourceDir] property, see here for some info:

    If you want to script it in VBScript, you would need to learn how to use the XML DOM ( to manipulate and read XML files.

    Hope this helps,

    Author Comment


    Thanks for the insight.  This is kind of what I was looking for.  I like winbatch because it's easy for me to understand.

    LVL 12

    Expert Comment

    Thanks for the grade!  The only other thing I would add is that you should make your custom routine's actions very transparent via logging, either to a log file or to the application event log.  If you don't log well, you'll make troubleshooting problems a nightmare!

    Good luck,

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now