Functions

Functions generate (partial) input for text-based properties of Tasks. This makes it possible to create information in various fields in Tasks automatically.

Examples

  • A log file c:\log\log.txt is generated daily. You want to store each log file rather than overwriting it each day. This can be achieved by renaming each new log file to show the creation date, using the function @[DATETIME]:

    In the Task Perform File Operations, type c:\log\log.txt in the field Source path, and c:\log\@[DATETIME(DDMMYY)]log.txt in the field Destination path.

    Each time this Task is executed, the file c:\log\log.txt is renamed to include the date at that moment. If the Task runs on 25 September 2015, the file becomes 250915log.txt, the next day 260915log.txt, etc.

  • When creating new Active Directory users, you want to generate a User Logon Name that has the first three letters of a user's first name followed by the full surname. You fill the first name and last name using parameters. This can be achieved using the function @[SUBSTRING]:

    In the Task Create Active Directory User, fill the fields First name and Last name with the parameters $[firstname] and $[lastname].

    In the field User logon name, type: @[SUBSTRING($[firstname],1,3)]$[lastname]. (Here the SUBSTRING function takes the first three characters of the $[firstname] parameter's value.)

    Each time this Task is executed, the User Logon Name is generated out of the values provided for the parameters for first name and last name. For Amanda Cavendish, for example, resulting User Logon Name is AmaCavendish. For John Smith, it is JohSmith.

Configuration

Functions are inserted by right-clicking in a text field when configuring or editing a Task in a Module. The selected function is inserted into the field as a pattern for the necessary format. If relevant, change the pattern to the actual function format. For example, Ivanti Automation will provide the pattern @[DATETIME(<format>)], but you need to fill out the desired format for the information.

Set up Tasks using a function

  • Open a Module at Library > Module, open a Task in the Module, click the Settings tab, right-click a text field, select Insert Functions and click the relevant function. This functionality may not be available, depending on the type of Task.

Set up parameters using a function

  • Add or edit any type of parameter, click the Properties tab, right-click a field that specifies the value of the parameter, select Insert Functions and click the relevant function. The name of this field may differ, depending on the type of Task. This functionality may not be available, depending on the type of Task.

Function

Returns

Example

@[CALC(<num1>,<{+,-,*,/,^}>,<num2>)]

a calculated value.

If @[GET-MEMORY] returns "2145456128", then @[CALC(@[GET-MEMORY],*,2)] returns "4290912256"

@[DATETIME(<format>)]

the current date and/or time in the specified format.

The Agent format uses the Microsoft standard; in short Y, M, D, H, N, S for year, month, day, hour, minutes and seconds. Please also refer to http://www.vb6.us/tutorials/formating-dates-and-times-vb6.

On September 25, 2015 at 17:04:23:

for Agents:

  • @[DATETIME(YYYYMMDDHHNNSS)] returns "20150925170423"
  • @[DATETIME(YYYY-MM-DD HH:NN)] returns "2015-09-25 17:04"
  • @[DATETIME(HH:NN)] returns "17:04"
  • @[DATETIME(SS)] returns "23"

@[FILEVERSION(<filename>)]

the file version of the specified file.

"1.00.0001"

@[FINDINFILE(<filename>,<search>,<return offset>,<return length>)

a string from the specified section in a specific file.

@[FINDINFILE(C:\WINDOWS\system32\drivers\etc\hosts,localhost,1,5)] returns "ocalh"

@[GET-ASSETTAG]

any asset tag of the producer of the computer of the Agent.

 

@[GET-COMPUTERFUNCTION]

the type of software the computer of the Agent is running.

Ivanti Automation can recognize the following computer functions:

  • "Microsoft SQL Server"
  • "Primary domain controller"
  • "Backup domain controller"
  • "Running the Timesource service"
  • "Apple File Protocol server"
  • "Novell server"
  • "LAN Manager 2.x domain Member"
  • "Sharing Print queue"
  • "Running dial-in service"
  • "Xenix server"
  • "Microsoft File and Print for Netware"
  • "Running a Browser service as backup"
  • "Running the master Browser service"
  • "Running the domain master Browser"
  • "Terminal Server"

@[GET-COMPUTERNAME]

the computer name of the Agent.

"NYHQSQL01"

@[GET-FQDN]

the fully qualified domain name of the Agent.

"NYHQSQL01.D-ENERGY.res.nl"

@[GET-IPV4]

the IP address of the Agent that executes the Task. If an Agent has multiple network cards, Ivanti Automation will return the first IP address of the Agent as defined by its Network Connections settings.

"172.16.41.20"

@[GET-IPV4ALL]

all IP addresses of the Agent that executes the Task. If the Agent has multiple network cards, multiple entries will be returned, if the Agent only has one network card, only one IP address will be returned.

"172.16.41.20;192.168.140.1;192.168.186.1"

@[GET-IPV6]

the IPv6 address of the Agent that executes the Task. If an Agent has multiple network cards, Ivanti Automation will return the first IP address of the Agent as defined by its Network Connections settings.

"2001:4016:1018:246:b4c8:d5e3:ac83:5855"

@[GET-IPV6ALL]

all IPv6 addresses of the Agent that executes the Task, excluding link-local addresses. If the Agent has multiple network cards, multiple entries will be returned, if the Agent only has one network card, only one IP address will be returned.

"2001:4016:1082:354:d1d6:ace4:8d8a:a2c3;2001:4016:1018:246:b4c8:d5e3:ac83:5855"

@[GET-MEMORY]

the amount of memory installed on the Agent.

"2145456128"

@[GET-OS-BIT]

the bit version of the operating system of the Agent.

"32"

@[GET-OS-SUITES]

the product suites available on the operating system of the Agent.

Ivanti Automation can recognize the following product suites:

  • "BackOffice components installed"
  • "Windows Home Edition"
  • "Windows Server Compute Cluster Edition"
  • "Windows Server Datacenter Edition"
  • "Windows Server Enterprise Edition"
  • "Windows Server Web Edition"
  • "Windows Small Business Server"
  • "Windows Storage Server"
  • "Windows XP Embedded"

@[GET-OS-TYPE]

the computer type of the Agent.

"WORKSTATION"

@[GET-OS-VERSION]

the version number of the operating system of the Agent.

If the operating system of the Agent is Microsoft Windows XP": @[GET-OS-VERSION] returns for example "5.1.200"

@[GUID]

an alpha-numeric string that is unique in the entire Ivanti Automation environment, enclosed in curly brackets.

{9C15453A-DDDE-4EB1-BC4D-0E6AE3BBF17E}

@[LOWER(<value>]

sets all characters in a value in lower case. This function is typically used in combination with parameters and/or other functions, and is useful for example when provisioning user accounts, when it is necessary to control lower-case characters as part of best practice naming conventions for FQDN domain names, Login names, etc.

If you create a parameter $[FQDN server] and the FQDN of a server is "SRV01.demo.com", @[LOWER($[FQDN server])] returns "srv01.demo.com".

@[MASTERJOBGUID]

the unique identifier of the master (Module, Project or Run Book) Job that is running.

If you export the job results based on the Master Job GUID, for example:

{7DF4C174-3C1C-46DD-8454-C333CD8613F2}

@[MAX(<num1>,<num2>)]

the maximum value of two specified values.

If @[GET-MEMORY] returns "2145456128", then @[MAX(4000000000,@[GET-MEMORY])] returns "4000000000"

@[MIN(<num1>,<num2>)]

the minimum value of two specified values.

If @[GET-MEMORY] returns "2145456128", then @[MIN(4000000000,@[GET-MEMORY])] returns "2145456128"

@[RANDOM(<min>,<max>)]

a random decimal number between the set minimum and maximum.

  • minimum allowed value: 0
  • maximum allowed value: 2147483647

@[RANDOM(1,100)] returns a number from 1 up to and including 100

@[RANDOM(<min>,<max>,(<returnhex>))]

a hexadecimal value for a random decimal number between the set minimum and maximum. (<returnhex>) is an optional value. Please remove the brackets when using it in a function.

@[RANDOM(1,100,1)] returns a hexadecimal value for a number from 1 up to and including 100

@[REGISTRY(<registry value>)]

the value of the specified registry value name.

If your Ivanti Automation environment uses an MSSQL database:

@[REGISTRY(HKEY_LOCAL_MACHINE\SOFTWARE\RES\AutomationManager\WMC\DBType)] returns "MSSQL"

@[REPLACE(<value>,<find>,<replace>)]

replaces all specified characters in the given expression with other characters.

On the E-mail Addresses tab of the Task Manage Active Directory User, you can base the user's e-mail address on a variable, such as %d for the display name. Use the REPLACE function to replace blanks in the display name with another character.

For example, with the display name Dan van Zandt, @[REPLACE(%[email protected], ,)] returns [email protected]. The blanks have been deleted.

@[REPLACE-DIACRITICS(<value>)]

convert characters containing diacritics to an ASCII equivalent. For example, if you use data from an external HR system to create new users in Active Directory, but you do not want user names to contain diacritics, you can use this function to prevent this.

 

@[SUBSTRING(<value>,<start>)]

all the characters from the given string, starting from the given position.

@[SUBSTRING(Robert,2)] returns "obert" (= the 2nd character and all following characters of the string "Robert")

@[SUBSTRING(<value>,<start>,(<length>))]

all the characters from the given string, starting from the given position, with a maximum number of characters returned. (<length>) is an optional value. Please remove the brackets when using it in a function.

@[SUBSTRING(Robert,2,3)] returns "obe" (= the 2nd character and subsequent characters up to a maximum of 3 characters)

@[UPPER(<value>)]

sets all characters in a value in upper case. This function is typically used in combination with parameters and/or other functions, and is useful for example when provisioning user accounts, when it is necessary to control upper-case characters as part of best practice naming conventions for FQDN domain names, Login names, etc.

If you create a parameter $[FQDN server] and the FQDN of a server is "srv01.DEMO.COM", @[UPPER($[FQDN server])] returns "SRV01.DEMO.COM".