Previous Topic: Store CommandsNext Topic: Script Example


Apply Commands

The following are the Apply commands used in CA DMM scripts.

ApplyDirectory

Applies a directory's contents from the source to the destination computer. This command takes two or three parameters. The first parameter is the directory path and is a string value. The second parameter is one of the following overwrite constants or a new directory path. There are three constants which indicate the overwrite method: ALWAYS, NEWER or NEVER. If the overwrite constant is omitted, the default NEWER or the user selected overwrite method is applied. If the second parameter is a new directory path, the contents of the directory <directory name> are applied to <new directory name>. An optional overwrite method is permitted. Only directories that have been stored can be applied. When moving, if the storing path contains a wildcard string, do not include the wildcard in the moving path.

First parameter:

The Directory name (string value)

Second parameter:

The new Directory name (string value)

Third parameter:

The overwrite method (string value)

Usage:
ApplyDirectory(<Directory name>, [overwrite method]); or
ApplyDirectory(<Directory name>, <new Directory name>, [overwrite method]);
Example:
ApplyDirectory("c:\\My Documents");
ApplyDirectory("c:\\My Documents", NEWER);
ApplyDirectory("c:\\My Documents", "c:\\Word Documents");
ApplyDirectory("c:\\My Documents", "c:\\Word Documents", ALWAYS);
/*Wildcard example*/
ApplyDirectory("c:\\My Documents\\*.fol", "c:\\New Path\\Word Documents", ALWAYS);
ApplyFile

Applies a file from the source to the destination computer. This command takes two or three parameters. The first parameter is the file name and is a string value. The second parameter is one of the following overwrite constants or a new file path. There are three constants which indicate the overwrite method: ALWAYS, NEWER or NEVER. If the overwrite constant is omitted, the default NEWER or the user selected overwrite method is applied. If the second parameter is a new file path, the file <file name> is applied to <new file name>. An optional overwrite method is allowed as well. This command recognizes the asterisk (*) as a wildcard. Only files that were stored can be applied. When moving, if the storing path contains a wildcard string, do not include the wildcard in the moving path.

First parameter:

The File name (string value)

Second parameter:

The new File name (string value)

Third parameter:

The overwrite method (string value)

Usage:
ApplyFile(<File name>, [overwrite method]); or
ApplyFile(<File name>, <new File name>, [overwrite method]);
Example:
ApplyFile("c:\\temp\\file.txt");
/*Wildcard example*/
ApplyFile("c:\\My Documents\\*.txt", "c:\\New Path\\Word Documents", ALWAYS);
ApplyKey

Applies a registry key including all of its values or an ini file section with all of its values from the source to the destination computer. This command can take two parameters. Only keys that were stored can be applied.

First parameter:

The Key path (string value)

Second parameter:

The new Key path (string value)

Usage:
ApplyKey(<Key path>, [new Key path]);
Example
ApplyKey("HKLM\\Software\\Microsoft\\Office\\8.0\\Word\\Data\\Toolbar");
ApplyMappedFile

Applies a file from the source to the destination computer. If any of the file's data specifies a directory path, it is mapped to the appropriate path.

First parameter:

The File path (string value)

Second parameter:

The new File name (string value)

Third parameter:

The overwrite method (string value)

Usage:
ApplyMappedFile(<File name>, [overwrite method]); or
ApplyMappedFile(<File name>, <new File name>, [overwrite method]);
Examples:
ApplyMappedFile("c:\\temp\\file.txt");
ApplyMappedFile("c:\\My Documents\\file.txt", "c:\\New Path\\Word Documents\\file.txt", ALWAYS);
ApplyMappedKey

Applies a registry key and all its values or an ini file section and all its values from the source to the destination machine. If any of the value names or value data is a directory path, they are mapped to the appropriate path. This command can take two parameters. Only keys that were stored can be applied.

First parameter:

The Key path (string value)

Second parameter:

The new Key path (string value)

Usage:
ApplyMappedKey(<Key path>, [new Key path]);
Example:
ApplyMappedKey("HKLM\\Software\\Microsoft\\Office\\8.0\\Word\\Data\\Toolbar");
ApplyMappedSubKeys

Applies a registry key, all its values and all its subkeys, or an ini file section and all its values from the source to the destination computer. If any of the value names or value data is a directory path, they are mapped to the appropriate path. This command can take two parameters. Only keys that were stored can be applied.

First parameter:

The Key path (string value)

Second parameter:

The new Key path (string value)

Usage:
ApplyMappedSubKeys(<Key path>, [new Key path]);
Example:
ApplyMappedSubKeys("HKLM\\Software\\Microsoft\\Office\\8.0\\Word\\Data\\Toolbar");
ApplyMappedValue

Applies a registry key value or an .ini file value from the source to the destination computer. If the value name or value is a directory path, it is mapped to the appropriate path. The command can take six parameters. Only values that were stored mapped can be applied mapped.

First parameter:

The Key path (string value)

Second parameter:

The Value name (string value)

Note: If the value is the default value, the second parameter should be NULL ("")

Third parameter:

The new Key path (string value)

Note: If not moving the value to new location, the third parameter should be NULL ("")

Fourth parameter:

The delimiter (string value)

Fifth parameter:

Shortpaths indicator (Boolean value)

Sixth parameter:

If moving, the new Value name (string value)

Usage:
ApplyMappedValue(<Key path>, <Value name>, [new Key path], [delimiter], [shortpaths], [new Value name]);
Examples:
ApplyMappedValue("HKCU\\Software\\Microsoft\\Office\\8.0\\Common\\Toolbar", "Tooltips");
ApplyMappedValue("HKCU\\Software\\Microsoft\\Office\\8.0\\Common\\Toolbar", "Tooltips","HKLM\\Software\\Microsoft\\Office\\8.0\\Common\\Toolbar");
ApplyMappedValue("HKCU\\Software\\Microsoft\\Office\\8.0\\Common\\Toolbar", "Tooltips", "HKLM\\Software\\Microsoft\\Office\\8.0\\Common\\Toolbar", ";");
ApplyMappedValue("HKCU\\Software\\Microsoft\\Office\\8.0\\Common\\Toolbar", "Tooltips", "", ";");
ApplyMappedValue("HKCU\\Software\\Microsoft\\Office\\8.0\\Common\", "Tooltips", "", ";", true);
ApplySubKeys

Applies a registry key, all of its values and all of its subkeys from the source to the destination computer. This command can take two parameters. Only keys that were stored can be applied.

First parameter:

The Key path (string value)

Second parameter:

The new Key path (string value)

Usage:
ApplySubKeys(<Key path>, [new Key path]);
Example:
ApplySubKeys("HKCU\\Software\\Microsoft\\Office\\8.0\\Word");
ApplyValue

Applies a registry key value from the source to the destination computer. This command takes four parameters. Only values that were stored can be applied.

First parameter:

The Key path (string value)

Second parameter:

The Value name (string value)

Third parameter:

The new Key path (string value)

Fourth parameter:

The new Value name (string value)

Usage:
ApplyValue(<Key path>, <Value name>, [new Key path], [new Value name]);
Example:
ApplyValue("HKCU\\Software\\Microsoft\\Office\\8.0\\Common\\Toolbar", "Tooltips");
DeleteKey

Deletes a key and all of its values and subkeys from the registry or ini files. Returns False if there were problems deleting the key. If the key does not exist, it returns True. If the path is to an ini file, then all sections in the ini file are deleted.

First parameter:

The Key path (string value)

Example:
DeleteKey( "HKCU\\Software\\MyApp");
DeleteKey( "c:\\windows\\test.ini\\Keyname");
/* all keys deleted */
DeleteKey( "c:\\windows\\test.ini");
DeleteValue

Deletes a value from the registry or ini files. Returns False if there were problems deleting the value. If the value does not exist, it will return True.

First parameter:

The Key path (string value)

Second parameter:

The Value Name (string value)

Example:
DeleteValue( "HKCU\\Software\\MyApp", "SomeValue");
DeleteValue( "c:\\windows\\win.ini\", "SomeValue");
SetKey

Creates or sets a key.

First parameter:

The Key path (string value)

Example:
SetKey("HKLM\\New Key");
SetValue

The SetValue command creates or sets a key value. If the key does not exist, this command creates the key.

This command has the following format:

SetValue(<FilePath>, <ValueName>, <Data>, <Type>)
FilePath

(For registry) Represents the key path (string value).

(For XML) Represents the complete file path.

ValueName

(For registry) Represents the value name (string value).

(For XML) Represents the valid XPath query.

Data

Represents the value.

Type

Represents the value type.

The following are the registry values that are accepted:

Value

Format

Example

STRING

string

"Brian"

DWORD

number

"1999"

BINARY

binary

"af 45 99 31"

DWORD_LITTLE_ENDIAN

number

"1234"

DWORD_BIG_ENDIAN

number

"1234"

SYMBOLIC_LINK

binary

"af 45 99 31"

MULTI_STRING

binary

"af 45 99 31"

RESOURCE_LIST

binary

"af 45 99 31"

EXPAND_STRING

string

"Brian"

FULL_RESOURCE_DESCRIPTOR

binary

"af 45 99 31"

RESOURCE_REQUIREMENTS_LIST

binary

"af 45 99 31"

Examples: Set a Key Value