USMT - migrating based on contents of an INI entry
- Ok, 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
Answers
- Oh joy.
Looks like that function is... borked.
If in the INI file I put:
Directory=c:\program files\something
Fail - no backup.
If in the INI file I put:
Directory=c:\progra~1\something
Works.
So obviously the function cannot deal with entries with spaces in the name - which makes it fairly well useless :-(
Hope this saves someone beating their head of a wall for a few weeks.
Cheers,
Mike- Marked As Answer byNicholas LiMSFT, ModeratorFriday, November 13, 2009 6:34 AM
All Replies
Hi Mike,
Thank you for posting here.
Regarding your question, I would like to share the following information for your reference:
In this document, please also note the usage of “MigXmlHelper.GetStringContent”.
For discussing USMT related questions, we have a specified discussion group; therefore, to get this question addressed efficiently, it is recommended that you post your question to this discussion group:
Thank you for your understanding and cooperation. I hope this will be resolved soon!
TechNet Subscriber Support in forum
If you have any feedback on our support, please contact tngfb@microsoft.com.
Nicholas Li - MSFT- Hi Nicholas,
Unfortunately I have already read through the documentation specified but it gives no examples on how to use INI with MigXmlHelper.GetStringContent . In this instance the reference documentation is *very* poor :-(
I will try the USMT group - thanks for the pointer.
Cheers,
Mike
- Oh joy.
Looks like that function is... borked.
If in the INI file I put:
Directory=c:\program files\something
Fail - no backup.
If in the INI file I put:
Directory=c:\progra~1\something
Works.
So obviously the function cannot deal with entries with spaces in the name - which makes it fairly well useless :-(
Hope this saves someone beating their head of a wall for a few weeks.
Cheers,
Mike- Marked As Answer byNicholas LiMSFT, ModeratorFriday, November 13, 2009 6:34 AM
Hi Mike,
Thank you for your update.
I also hope this information you shared with us will benefit some other users who meet the similar issue. You efforts on investigating this issue are highly appreciated.
In the future, if you experience any issues regarding our products or if you have some feedbacks, you are also welcome to post a new thread in our forum. It is always our pleasure to be of assistance.
Thanks again! Have a great day!
Nicholas Li
TechNet Subscriber Support in forum
If you have any feedback on our support, please contact tngfb@microsoft.com.
Nicholas Li - MSFT