Jump to content

USMT - reading contents of an INI file


Recommended Posts

Posted

While this isn't actually a Windows 7 question, it's a migration question with regards Windows 7 supplied tools :-)

I hope someone might be able to help with this. I'm doing some work with USMT4 and I have an app that stores data in a folder. This folder is per user specific and to get the information I need to:

a) Read the user registry to get the INI location

B) Open the INI file and read the entry that contains the data folder

c) Backup the data folder

Now I've done some reading of the USMT reference guide and in theory this is possible. In practice I'm failing miserably, so I'm hoping someone can point out the error of my ways :-). Unfortunately the reference/examples for INI reading is very sparse.

Here is my USMT XML:

<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="http://www.microsoft.com/migration/1.0/migxmlext/test">
<!-- Multi-User migrate setup -->
<component context="User" type="Documents">
<environment>
<variable name="testINIPath">
<script>MigXmlHelper.GetStringContent("Registry","HKCU\Software\Mike [testINI]")</script>
</variable>
<variable name="testDataPath">
<script>MigXmlHelper.GetStringContent("INI","%testINIPath%|Notes[Directory]")</script>
</variable>
</environment>
<displayName>Multiuser app</displayName>
<role role="Data">
<rules>
<include>
<objectSet>
<pattern type="File">%TestDataPath%\* [*]</pattern>
</objectSet>
</include>
</rules>
</role>
</component>
</migration>

So the theory is:

a) The variable "testINIPath" gets populated from the registry HKCU\Software\Mike [testINI]

B) Using the fully named INI (in the testINIPath variable), the INI is opened and then entry "Directory" (from the "Notes" section) is retrieved into "testDataPath"

c) The contents of "testDataPath" is backed up.

But as I've stated it does nothing :-(

Pointers welcomed - and if this is the wrong forum, if someone could point me to the correct place it would be appreciated.

Cheers,

Mike


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...