Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Wise Package Studio Custom Action vbscript XML

Posted on 2011-05-10
5
Medium Priority
?
844 Views
Last Modified: 2012-05-11
Hi,

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?

Thanks
0
Comment
Question by:Paraleptropy
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Daz_1234
ID: 35736034
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?

Regards,
Daz.
0
 

Author Comment

by:Paraleptropy
ID: 35737065
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='http://schemas.microsoft.com/wix/2006/wi'>
   <Product Id='{929E7AB8-2E59-4C9B-B15A-C89D1E7BFC47}' Name='My package.msi' Language='1033' 
            Version='38.8.5.1' 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' />
</Feature>
  
<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"/>
                     </Component>
		   </Directory>
		 </Product>
</Wix>

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!
0
 
LVL 13

Accepted Solution

by:
Daz_1234 earned 500 total points
ID: 35737146
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: http://techsupt.winbatch.com/ts/T000001001F1.html) 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: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/6d897c10-8b41-4d5d-b154-a8014b798bf7)

If you want to script it in VBScript, you would need to learn how to use the XML DOM (http://msdn.microsoft.com/en-us/library/aa468547.aspx) to manipulate and read XML files.

Hope this helps,
Daz.
0
 

Author Comment

by:Paraleptropy
ID: 35738422
Daz,

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

Thanks!
0
 
LVL 13

Expert Comment

by:Daz_1234
ID: 35738477
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,
Daz.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Screencast - Getting to Know the Pipeline
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

575 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