When building runbooks in System Center Orchestrator 2012, you might find that there are settings that are the same across different activities. When you must update these values, it becomes inconvenient to change each activity individually. Variables enable you to specify a value in one location and then use that value anywhere else by inserting the variable into the activity.

Use the following procedures to create, insert, and organize variables.

To create a variable

  1. From the Connections pane in the Runbook Designer, expand the Global Settings folder, and click the Variables folder.

  2. Right-click the Variables folder or a subfolder of the Variables folder, point to New, and then click Variable to open the New Variable dialog box.

  3. Type a Name for the variable.

  4. Type a Description that explains the purpose of the variable.

  5. Type the Value of the variable. This value replaces the placeholder in those activities where the variable is inserted.

  6. Click Finish.

To insert a variable in an activity

  1. Right-click the applicable activity from your runbook, from the menu select Properties, and then select the Details tab to open the activities properties dialog box.

  2. In the Computer box, right-click to open a menu, select Subscribe, and then select Variable to open the Select a Variable dialog box.

  3. Select the variable name, and then click OK.

    A placeholder {variable} is inserted next to the computer name in the Computer box.

    When the activity runs, the placeholder is replaced with the value of the variable.

To organize variables

  1. You can group variables into folders to organize them. To create a folder, right-click the Variables folder, point to New, and then click Runbook Folder.

  2. To move a variable to a different folder, right-click the variable, and then click Move to open the Select a Folder dialog box.

  3. Select the destination folder, and then click OK. The variable is moved to the new folder location.

Special Variables

You can specify special formats of variables to provide dynamic information to your runbooks. Specify the value of the variable to invoke this behavior.

NOW(): When the variable is resolved, it is set to the current date and time. You can pass arguments to this function to return specific portions of the date or time. For example, NOW(hour) returns the current hour. The following are the valid arguments for the NOW() function: day, dayofweek, dayofyear, month, year, hour, minute, second, millisecond.

%ENVVAR%: Returns the value of the environment variable between the percent (%) symbols. The environment variable is based on the runbook server computer where the runbook is running, and it is not case-sensitive. Only system variables can be resolved. User variables are not resolved. If the environment variable does not exist, the text specified within the variable will be published as-is (that is, if you type %ENVVAR% and no environment variable named ENVVAR exists, then the text ‘%ENVVAR%’ will be published).