--- title: XML Elements Library (Windows 10) description: XML Elements Library ms.assetid: f5af0f6d-c3bf-4a4c-a0ca-9db7985f954f ms.prod: w10 ms.mktglfcycl: deploy ms.sitesec: library author: greg-lindsay ms.date: 04/19/2017 --- # XML Elements Library ## Overview This topic describes the XML elements and helper functions that you can employ to author migration .xml files to use with User State Migration Tool (USMT). It is assumed that you understand the basics of XML. . ## In This Topic In addition to XML elements and helper functions, this topic describes how to specify encoded locations and locations patterns, functions that are for internal USMT use only, and the version tags that you can use with helper functions. - [Elements and helper functions](#elements) - [Appendix](#appendix) - [Specifying locations](#locations) - [Internal USMT functions](#internalusmtfunctions) - [Valid version tags](#allowed) ## Elements and Helper Functions The following table describes the XML elements and helper functions you can use with USMT.
Elements A-K | Elements L-Z | Helper functions |
---|---|---|
[<addObjects>](#addobjects) [<attributes>](#attribute) [<bytes>](#bytes) [<commandLine>](#commandline) [<component>](#component) [<condition>](#condition) [<conditions>](#conditions) [<content>](#content) [<contentModify>](#contentmodify) [<description>](#description) [<destinationCleanup>](#destinationcleanup) [<detect>](#detect) [<detects>](#detects) [<detection>](#detection) [<displayName>](#displayname) [<environment>](#bkmk-environment) [<exclude>](#exclude) [<excludeAttributes>](#excludeattributes) [<extensions>](#extensions) [<extension>](#extension) [<externalProcess>](#externalprocess) [<icon>](#icon) [<include>](#include) [<includeAttribute>](#includeattributes) |
[<library>](#library) [<location>](#location) [<locationModify>](#locationmodify) [<_locDefinition>](#locdefinition) [<manufacturer>](#manufacturer) [<merge>](#merge) [<migration>](#migration) [<namedElements>](#namedelements) [<object>](#object) [<objectSet>](#objectset) [<path>](#path) [<paths>](#paths) [<pattern>](#pattern) [<processing>](#processing) [<plugin>](#plugin) [<role>](#role) [<rules>](#rules) [<script>](#script) [<text>](#text) [<unconditionalExclude>](#unconditionalexclude) [<variable>](#variable) [<version>](#version) [<windowsObjects>](#windowsobjects) |
[<condition> functions](#conditionfunctions) [<content> functions](#contentfunctions) [<contentModify> functions](#contentmodifyfunctions) [<include> and <exclude> filter functions](#persistfilterfunctions) [<locationModify> functions](#locationmodifyfunctions) [<merge> functions](#mergefunctions) [<script> functions](#scriptfunctions) [Internal USMT functions](#internalusmtfunctions) |
Setting | Required? | Value |
---|---|---|
Content |
Yes |
The content depends on the type of object specified.
|
Setting | Required? | Value |
---|---|---|
string |
No, default is No |
Determines whether Content should be interpreted as a string or as bytes. |
expand |
No (default = Yes |
When the expand parameter is Yes, the content of the <bytes> element is first expanded in the context of the source computer and then interpreted. |
Content |
Yes |
Depends on the value of the string.
|
Setting | Required? | Value |
---|---|---|
CommandLineString |
Yes |
A valid command line. |
Setting | Required? | Value |
---|---|---|
type |
Yes |
You can use the following to group settings, and define the type of the component.
|
context |
No Default = UserAndSystem |
Defines the scope of this parameter; that is, whether to process this component in the context of the specific user, across the entire operating system, or both. The largest possible scope is set by the <component> element. For example, if a <component> element has a context of User and a <rules> element had a context of UserAndSystem, then the <rules> element would act as though it has a context of User. If a <rules> element has a context of System, it would act as though the <rules> element is not there.
|
defaultSupported |
No (default = TRUE) |
Can be any of TRUE, FALSE, YES or NO. If this parameter is FALSE (or NO), the component will not be migrated unless there is an equivalent component on the destination computer. When type="System" and defaultSupported="FALSE" the settings will not migrate unless there is an equivalent component in the .xml files that are specified on the LoadState command line. For example, the default MigSys.xml file contains components with type="System" and defaultSupported="FALSE". If you specify this file on the ScanState command line, you must also specify the file on the LoadState command line for the settings to migrate. This is because the LoadState tool must detect an equivalent component. That is, the component must have the same migration urlid of the .xml file and an identical display name or the LoadState tool will not migrate those settings from the store. This is helpful when the source computer is running Windows XP, and you are migrating to both Windows Vista and Windows XP because you can use the same store for both destination computers. |
hidden |
|
This parameter is for internal USMT use only. |
Setting | Required? | Value |
---|---|---|
negation |
No Default = No |
"Yes" reverses the True/False value of the condition. |
ScriptName |
Yes |
A script that has been defined within this migration section. |
Setting | Required? | Value |
---|---|---|
OSType |
Yes |
The only valid value for this setting is NT. Note, however, that you must set this setting for the <condition> functions to work correctly. |
OSVersion |
Yes |
The major version, minor version, build number and corrected service diskette version separated by periods. For example, |
Setting | Required? | Value |
---|---|---|
OSType |
Yes |
Can be 9x or NT. If OSType does not match the type of the current operating system, then it returns FALSE. For example, if the current operating system is Windows NT-based and OSType is “9x”, the result will be FALSE. |
OSVersion |
Yes |
The major version, minor version, build number, and corrected service diskette version separated by periods. For example, The IsOSLaterThan function returns TRUE if the current operating system is later than or equal to OSVersion. |
Setting | Required? | Value |
---|---|---|
OSType |
Yes |
Can be 9x or NT. If OSType does not match the type of the current operating system, then it returns FALSE. For example, if the current operating system is Windows NT-based and OSType is “9x” the result will be FALSE. |
OSVersion |
Yes |
The major version, minor version, build number, and corrected service diskette version separated by periods. For example, The IsOSEarlierThan function returns TRUE if the current operating system is earlier than OSVersion. |
Setting | Required? | Value |
---|---|---|
ObjectType |
Yes |
Defines the object type. Can be File or Registry. |
EncodedLocationPattern |
Yes |
The [location pattern](#locations). Environment variables are allowed. |
Setting | Required? | Value |
---|---|---|
EncodedFileLocation |
Yes |
The [location pattern](#locations) for the file that will be checked. Environment variables are allowed. |
VersionTag |
Yes |
The [version tag](#allowed) value that will be checked. |
VersionValue |
Yes |
A string pattern. For example, "Microsoft*". |
Setting | Required? | Value |
---|---|---|
EncodedFileLocation |
Yes |
The [location pattern](#locations) for the file that will be checked. Environment variables are allowed. |
VersionTag |
Yes |
The [version tag](#allowed) value that will be checked. |
VersionValue |
Yes |
The value to compare to. You cannot specify a pattern. |
Setting | Required? | Value |
---|---|---|
EncodedFileLocation |
Yes |
The [location pattern](#locations) for the file that will be checked. Environment variables are allowed. |
VersionTag |
Yes |
The [version tag](#allowed) value that will be checked. |
VersionValue |
Yes |
The value to compare to. You cannot specify a pattern. |
Setting | Required? | Value |
---|---|---|
ObjectType |
Yes |
Defines the type of object. Can be File or Registry. |
EncodedLocationPattern |
Yes |
The [encoded location](#locations) for the object that will be examined. You can specify environment variables. |
StringContent |
Yes |
The string that will be checked against. |
Setting | Required? | Value |
---|---|---|
ObjectType |
Yes |
Defines the type of object. Can be File or Registry. |
EncodedLocationPattern |
Yes |
The [encoded location](#locations) for the object that will be examined. You can specify environment variables. |
StrToFind |
Yes |
A string that will be searched inside the content of the given object. |
Setting | Required? | Value |
---|---|---|
ObjectType |
Yes |
Defines the type of object. Can be File or Registry. |
EncodedLocation1 |
Yes |
The [encoded location](#locations) for the first object. You can specify environment variables. |
EncodedLocation2 |
Yes |
The [encoded location](#locations) for the second object. You can specify environment variables. |
Setting | Required? | Value |
---|---|---|
ObjectType1 |
Yes |
Defines the type of the first object. Can be File or Registry. |
EncodedLocation1 |
Yes |
The [encoded location](#locations) for the first object. You can specify environment variables. |
ObjectType2 |
Yes |
Defines the type of the second object. Can be File or Registry. |
EncodedLocation2 |
Yes |
The [encoded location](#locations) for the second object. You can specify environment variables. |
Setting | Required? | Value |
---|---|---|
ObjectType1 |
Yes |
Defines the type of the first object. Can be File or Registry. |
EncodedLocation1 |
Yes |
The [encoded location](#locations) for the first object. You can specify environment variables. |
ObjectType2 |
Yes |
Defines the type of the second object. Can be File or Registry. |
EncodedLocation2 |
Yes |
The [encoded location](#locations) for the second object. You can specify environment variables. |
Setting | Required? | Value |
---|---|---|
operation |
No, default = AND |
Defines the Boolean operation that is performed on the results that are obtained from the child elements. |
Setting | Required? | Value |
---|---|---|
filter |
Yes |
A script followed by any number of string arguments that are separated by a comma and enclosed in parenthesis. For example The script is called for each object that is enumerated by the object sets in the <include> rule. The filter script returns a Boolean value. If the return value is TRUE, the object will be migrated. If it is FALSE, it will not be migrated. |
Setting | Required? | Value |
---|---|---|
Separators |
Yes |
A list of possible separators that might follow the file specification in this registry value name. For example, if the content is "C:\Windows\Notepad.exe,-2", the separator is a comma. You can specify NULL. |
PathHints |
Yes |
A list of extra paths, separated by colons (;), where the function will look for a file matching the current content. For example, if the content is "Notepad.exe" and the path is the %Path% environment variable, the function will find Notepad.exe in %windir% and returns "c:\Windows [Notepad.exe]". You can specify NULL. |
Setting | Required? | Value |
---|---|---|
Separators |
Yes |
A list of possible separators that might follow the file specification in this registry value name. For example, if the content is "C:\Windows\Notepad.exe,-2", the separator is a comma. This parameter must be NULL when processing MULTI-SZ registry values. |
PathHints |
Yes |
A list of extra paths, separated by colons (;), where the function will look for a file matching the current content. For example, if the content is "Notepad.exe" and the path is the %Path% environment variable, the function will find Notepad.exe in %windir% and returns "c:\Windows [Notepad.exe]". You can specify NULL. |
Setting | Required? | Value |
---|---|---|
Separators |
No |
A list of possible separators that might follow the file specification in this registry value name. For example, if the content is "C:\Windows\Notepad.exe,-2", the separator is a comma. You must specify NULL when processing MULTI-SZ registry values. |
LevelsToTrim |
Yes |
The number of levels to delete from the end of the directory specification. Use this function to extract a root directory when you have a registry value that points inside that root directory in a known location. |
PatternSuffix |
Yes |
The pattern to add to the directory specification. For example, |
Setting | Required? | Value |
---|---|---|
script |
Yes |
A script followed by any number of string arguments that are separated by a comma and enclosed in parenthesis. For example The script will be called for each object that is enumerated by the object sets in the include rule. The filter script returns a Boolean value. If the return value is TRUE, the object will be migrated. If it is FALSE, it will not be migrated. |
Setting | Required? | Value |
---|---|---|
DefaultValueOnError |
No |
The value that will be written into the value name if the conversion fails. You can specify NULL, and 0 will be written if the conversion fails. |
Setting | Required? | Value |
---|---|---|
DefaultValueOnError |
No |
The value that will be written into the value name if the conversion fails. You can specify NULL, and 0 will be written if the conversion fails. |
Setting | Required? | Value |
---|---|---|
Value |
Yes |
The string representation of a numeric value. It can be positive or negative. For example, |
Setting | Required? | Value |
---|---|---|
SourceTable |
Yes |
A list of values separated by commas that are possible for the source registry values. |
DestinationTable |
No |
A list of translated values separated by commas. |
DefaultValueOnError |
No |
The value that will be applied to the destination computer if either 1) the value for the source computer does not match SourceTable, or 2) DestinationTable has no equivalent value. If DefaultValueOnError is NULL, the value will not be changed on the destination computer. |
Setting | Required? | Value |
---|---|---|
OptionString |
Yes |
OptionString can be Security, TimeFields, or FileAttrib:Letter. You can specify one of each type of OptionStrings. Do not specify multiple OptionStrings with the same value. If you do, the right-most option of that type will be kept. For example, do not specify ("FileAttrib:H", "FileAttrib:R") because only Read-only will be evaluated. Instead specify ("FileAttrib:HR") and both Hidden and Read-only attributes will be kept on the destination computer.
|
Setting | Required? | Value |
---|---|---|
Instruction |
Yes |
Can be one of the following:
|
String |
Yes |
The string to be added or removed. |
Setting | Required? | Value |
---|---|---|
Delimiters |
Yes |
A single character that will be used to separate the content of the object that is being processed. The content will be considered as a list of elements that is separated by the Delimiters. For example, "." will separate the string based on a period. |
Instruction |
Yes |
Can one of the following:
|
String |
Yes |
The string to be added or removed. |
Setting | Required? | Value |
---|---|---|
ComponentDescription |
Yes |
The description of the component. |
Setting | Required? | Value |
---|---|---|
filter |
Yes |
A script followed by any number of string arguments that are separated by a comma and enclosed in parenthesis. For example The script will be called for each object that is enumerated by the object sets in the include rule. The filter script returns a Boolean value. If the return value is TRUE, the object will be migrated. If it is FALSE, it will not be migrated. |
Setting | Required? | Value |
---|---|---|
name |
Yes, when <detect> is a child to <namedElements> No, when <detect> is a child to <detects> |
When ID is specified, any child elements are not processed. Instead, any other <detect> elements with the same name that are declared within the <namedElements> element are processed. |
context |
No (default = UserAndSystem) |
Defines the scope of this parameter: whether to process this component in the context of the specific user, across the entire operating system, or both. The largest possible scope is set by the component element. For example, if a <component> element has a context of User, and a <rules> element had a context of UserAndSystem, then the <rules> element would act as though it had a context of User. If the <rules> element had a context of System, it would act as though the <rules> element were not there.
|
Setting | Required? | Value |
---|---|---|
name |
Yes, when <detects> is a child to <namedElements> No, when <detects> is a child to <role> or <rules> |
When ID is specified, no child <detect> elements are processed. Instead, any other <detects> elements with the same name that are declared within the <namedElements> element are processed. |
context |
No (default = UserAndSystem) |
Defines the scope of this parameter: whether to process this component in the context of the specific user, across the entire operating system, or both. The largest possible scope is set by the <component element>. For example, if a <component> element has a context of User and a <rules> element had a context of UserAndSystem, then the <rules> element would act as though it had a context of User. If the <rules> element had a context of System, it would act as though the <rules> element were not there.
The context parameter is ignored for <detects> elements that are inside <rules> elements. |
Setting | Required? | Value |
---|---|---|
name |
|
If declared, the content of the <detection> element is ignored and the content of the <detection> element with the same name that is declared in the <namedElements> element will be evaluated. |
context |
No, default = UserAndSystem |
Defines the scope of this parameter: whether to process this component in the context of the specific user, across the entire operating system, or both.
|
Setting | Required? | Value |
---|---|---|
locID |
No |
This parameter is for internal USMT use. Do not use this parameter. |
ComponentName |
Yes |
The name for the component. |
Setting | Required? | Value |
---|---|---|
name |
Yes, when <environment> is a child of <namedElements> No, when <environment> is a child of <role> or <component> |
When declared as a child of the <role> or <component> elements, if ID is declared, USMT ignores the content of the <environment> element and the content of the <environment> element with the same name declared in the <namedElements> element is processed. |
context |
No (default = UserAndSystem) |
Defines the scope of this parameter: whether to process this component in the context of the specific user, across the entire operating system, or both. The largest possible scope is set by the <component> element. For example, if a <component> element has a context of User and a <rules> element had a context of UserAndSystem, then the <rules> element would act as though it had a context of User. If the <rules> element had a context of System, it would act as though <rules> were not there.
|
Setting | Required? | Value |
---|---|---|
filter |
No (default = No) |
A script followed by any number of string arguments that are separated by a comma and enclosed in parenthesis. For example The script will be called for each object that is enumerated by the object sets in the include rule. The filter script returns a Boolean value. If the return value is TRUE, the object will be migrated. If it is FALSE, it will not be migrated. |
Parameter | Required? | Value |
---|---|---|
attributes |
Yes |
Specifies the attributes to be excluded. You can specify one of the following, or both separated by quotes; for example,
|
Setting | Required? | Value |
---|---|---|
FilenameExtension |
Yes |
A file name extension. |
Setting | Required? | Value |
---|---|---|
when |
Yes |
Indicates when the command line should be run. This value can be one of the following:
|
Setting | Required? | Value |
---|---|---|
filter |
No. If this parameter is not specified, then all patterns that are inside the child <ObjectSet> element will be processed. |
A script followed by any number of string arguments that are separated by a comma and enclosed in parenthesis. For example The script will be called for each object that is enumerated by the object sets in the <include> rule. The filter script returns a Boolean value. If the return value is TRUE, the object will be migrated. If it is FALSE, it will not be migrated. |
Setting | Required? | Value |
---|---|---|
StringContent |
Yes |
The string to check against. |
CompareType |
Yes |
A string. Use one of the following values:
|
Setting | Required? | Value |
---|---|---|
attributes |
Yes |
Specifies the attributes to be included with a migrated object. You can specify one of the following, or both separated by quotes; for example,
|
Setting | Required? | Value |
---|---|---|
type |
Yes |
typeID can be Registry or File. |
ObjectLocation |
Yes |
The location of the object. |
Setting | Required? | Value |
---|---|---|
script |
Yes |
A script followed by any number of string arguments that are separated by a comma and enclosed in parenthesis. For example The script will be called for each object that is enumerated by the object sets in the include rule. The filter script returns a Boolean value. If the return value is TRUE, the object will be migrated. If it is FALSE, it will not be migrated. |
Setting | Required? | Value |
---|---|---|
ObjectEncodedLocation |
Yes |
The destination [location](#locations) for all of the source objects. |
Setting | Required? | Value |
---|---|---|
DestinationRoot |
Yes |
The location where the source objects will be moved. If needed, this function will create any subdirectories that were above the longest CSIDL in the source object name. |
Setting | Required? | Value |
---|---|---|
SourceRoot |
Yes |
The location from where the objects will be moved. Any source objects that are enumerated by the parent <ObjectSet> element that are not in this location will not be moved. |
DestinationRoot |
Yes |
The location where the source objects will be moved to on the destination computer. If needed, this function will create any subdirectories that were above SourceRoot. |
Setting | Required? | Value |
---|---|---|
Name |
Yes |
The name of the manufacturer for the component. |
Setting | Required? | Value |
---|---|---|
script |
Yes |
A script followed by any number of string arguments that are separated by a comma and enclosed in parenthesis. For example The script will be called for each object that is enumerated by the object sets in the <include> rule. The filter script returns a Boolean value. If the return value is TRUE, the object will be migrated. If it is FALSE, it will not be migrated. |
Setting | Required? | Value |
---|---|---|
FilePattern |
Yes |
For example, |
Setting | Required? | Value |
---|---|---|
VersionTag |
Yes |
The version field that will be checked. This can be "FileVersion" or "ProductVersion". The file with the highest VersionTag version determines which conflicts will be resolved based on the file's version. For example, if Myfile.txt contains FileVersion 1 and the same file on the destination computer contains FileVersion 2, the file on destination will remain. |
Setting | Required? | Value |
---|---|---|
urlid |
Yes |
UrlID is a string identifier that uniquely identifies this .xml file. This parameter must be a no-colon-name as defined by the XML Namespaces specification. Each migration .xml file must have a unique urlid. If two migration .xml files have the same urlid, the second .xml file that is specified on the command line will not be processed. For more information about XML Namespaces, see [Use XML Namespaces](https://go.microsoft.com/fwlink/p/?LinkId=220938). |
Name |
No |
Although not required, it is good practice to use the name of the .xml file. |
Helper Function | MigXMLHelper.FileProperties (property, operator, valueToCompare) |
---|---|
Property |
filesize, dateCreated, dateModified, dateAccessed |
Operator |
range, neq, lte, lt, eq, gte, gt |
valueToCompare |
The value we are comparing. For example: Date: “2008/05/15-2005/05/17”, “2008/05/15” Size: A numeral with B, KB, MB, or GB at the end. “5GB”, “1KB-1MB” |
Setting | Required? | Value |
---|---|---|
type |
Yes |
typeID can be Registry, File, or Ini. If typeId is Ini, then you cannot have a space between Path and object. For example, the following is correct when type="Ini": <pattern type="Ini">%WinAmp5InstPath%\Winamp.ini|WinAmp[keeponscreen]</pattern> |
Path [object] |
Yes |
A valid registry or file path pattern, followed by at least one space, followed by brackets [] that contain the object to be migrated.
|
Setting | Required? | Value |
---|---|---|
when |
Yes |
Indicates when the script should be run. This value can be one of the following:
|
Setting | Required? | Value |
---|---|---|
role |
Yes |
Defines the role for the component. Role can be one of:
You can either:
|
Setting | Required? | Value |
---|---|---|
name |
Yes, when <rules> is a child to <namedElements> No, when <rules> is a child to any other element |
When ID is specified, any child elements are not processed. Instead, any other <rules> elements with the same name that are declared within <namedElements> are processed. |
context |
No (default = UserAndSystem) |
Defines the scope of this parameter — whether to process this component in the context of the specific user, across the entire operating system, or both. The largest possible scope is set by the component element. For example, if a <component> element has a context of User and a <rules> element had a context of UserAndSystem, then the <rules> element would act as though it has a context of User. If <rules> had a context of System, it would act as though <rules> was not there.
|
Setting | Required? | Value |
---|---|---|
ScriptWithArguments |
Yes |
A script followed by any number of string arguments that are separated by a comma and enclosed in parenthesis. For example The script will be called for each object that is enumerated by the object sets in the <include> rule. The filter script returns a Boolean value. If the return value is TRUE, the object will be migrated. If it is FALSE, it will not be migrated. The return value that is required by <script> depends on the parent element.
|
Setting | Required? | Value |
---|---|---|
ObjectType |
Yes |
The type of object. Can be Registry or Ini (for an .ini file). |
EncodedLocationPattern |
Yes |
|
ExpandContent |
No (default=TRUE) |
Can be TRUE or FALSE. If FALSE, then the given location will not be expanded before it is returned. |
Setting | Required? | Value |
---|---|---|
PatternSegment |
Yes |
The suffix of an encoded pattern. It will be concatenated with a drive specification, such as "c:\", to form a complete [encoded file pattern](#locations). For example, "* [*.doc]". PatternSegment cannot be an environment variable. |
DriveType |
Yes |
The drive type for which the patterns are to be generated. You can specify one of:
|
Setting | Required? | Value |
---|---|---|
ObjectType |
Yes |
Defines the object type. Can be File or Registry. |
EncodedLocationPattern |
Yes |
The [location pattern](#locations). Environment variables are allowed. |
ProcessCurrentUser |
Yes |
Can be TRUE or FALSE. Indicates if the patterns should be generated for the current user. |
Setting | Required? | Value |
---|---|---|
ScanProgramFiles |
No (default = FALSE) |
Can be TRUE or FALSE. The ScanProgramFiles parameter determines whether or not the document finder scans the Program Files directory to gather registered file extensions for known applications. For example, when set to TRUE it will discover and migrate .jpg files under the Photoshop directory, if .jpg is a file extension registered to Photoshop. |
IncludePatterns |
No (default = TRUE) |
Can be TRUE or FALSE. TRUE will generate include patterns and can be added under the <include> element. FALSE will generate exclude patterns and can be added under the <exclude> element. |
SystemDrive |
No (default = FALSE) |
Can be TRUE or FALSE. If TRUE, restricts all patterns to the system drive. |
Setting | Value |
---|---|
NormalText |
This is interpreted as normal text. |
Setting | Required? | Value |
---|---|---|
name |
Yes |
ID is a string value that is the name used to reference the environment variable. We recommend that ID start with the component’s name to avoid namespace collisions. For example, if your component’s name is MyComponent, and you want a variable that is your component’s install path, you could specify |
remap |
No, default = FALSE |
Specifies whether to evaluate this environment variable as a remapping environment variable. Objects that are located in a path that is underneath this environment variable’s value are automatically moved to where the environment variable points on the destination computer. |
Setting | Required? | Value |
---|---|---|
ComponentVersion |
Yes |
The version of the component, which can contain patterns. |