Previous Topic: Enumeration CommandsNext Topic: Store Commands


Exists Commands

CA DMM scripts use the following Exists commands:

DirectoryExists

Verifies that a directory exists. This command takes two parameters. The first parameter is the directory path and is a string value. The second parameter indicates whether to look on the source machine or the destination machine. The second parameter is optional and is a Boolean value. If the second parameter is True, the interpreter looks on the source machine for the specified file. If the parameter is false or omitted, the interpreter looks on the destination machine.

Note: The Boolean parameter can only be used during General and Apply functions. The parameter causes a syntax error or runtime error if used otherwise.

First parameter:

The Directory path (string value)

Second parameter:

The machine indicator (Boolean value)

Usage:
DirectoryExists( <Directory path>, [Boolean] );
Example:
if (DirectoryExists( "c:\\My Documents"))
 StoreDirectory( "c:\\My Documents");

if (DirectoryExists( "c:\\My Documents", SOURCE))
 ApplyDirectory( "c:\\My Documents");
FileExists

Verifies that a file exists either on the source machine or on the destination machine. The first parameter is the file path and is a string value. The second parameter indicates whether to look on the source machine or on the destination machine. The second parameter is optional and is a Boolean value. If the second parameter is True, the interpreter looks on the source machine for the specified file. If the parameter is False or omitted, the interpreter looks on the destination machine.

Note: The Boolean parameter can only be used during General and Apply functions. The parameter causes a syntax error or runtime error if used otherwise.

First parameter:

The File path (string value)

Second parameter:

The machine indicator (Boolean value)

Usage:
FileExists( <file path> );
Examples:
if (FileExists( "c:\\My Documents\\myfile.txt"))
    StoreFile( "c:\\My Documents\\myfile.txt");

if (FileExists( "c:\\My Documents\\myfile.txt", SOURCE))
KeyExists

Verifies that a registry key exists on the source machine or on the destination machine. It can take two parameters. The first parameter is the registry key path and is string value. The second parameter indicates whether to look on the source machine or the destination machine. The second parameter is optional and is a Boolean value. If the second parameter is True, the interpreter looks on the source machine for the specified key. If the parameter is False or omitted, the interpreter looks on the destination machine.

Note: The Boolean parameter can only be used during General and Apply functions. The Boolean parameter causes a syntax error or runtime error if used otherwise.

First parameter:

The Key path (string value)

Second parameter:

The machine indicator (Boolean value)

Usage:
KeyExists( <key path> );
Example:
if (KeyExists( "HKLM\\Software\\Microsoft\\Plus!", SOURCE))
ApplyKey( "HKLM\\Software\\Microsoft\\Plus!");
ValueExists

Verifies that a registry key value exists in the registry or INI file. This command can take two or three parameters. The first parameter is the registry key path and the second parameter is the value name. The first two parameters are required and are string values. The third parameter indicates whether to look on the source computer or destination computer. The third parameter is optional and a Boolean value. If the third parameter is True, the interpreter looks on the source computer for the specified key. If the parameter is False or omitted, the interpreter looks on the destination computer.

Note: The third Boolean parameter can only be used during General and Apply functions. The third Boolean parameter will cause a syntax error or runtime error if used otherwise.

First parameter:

The Key path (string value)

Second parameter:

The Value name (sting value)

Third parameter:

The machine (Boolean value)

Usage:
ValueExists( <Key path>, <Value name>, [Boolean] );
Example:
if (ValueExists( "HKCU\\Control Panel\\Desktop", "Smooth Scrolling", SOURCE))
ApplyValue( "HKCU\\Control Panel\\Desktop", "Smooth Scrolling");