Navigation:  Remote Monitoring and Management > Proactive Maintenance > Automation Manager >

Example Policy Breakdown

Previous pageReturn to chapter overviewNext page

It only takes a few short steps to construct a policy using the Automation Manager. The following example covers the process of creating a policy to check whether a folder exists. Where the folder does not exist, it is created.

 

We have divided this process into five steps:

 

Create a New Policy

Policy Workflow - add Objects

Configure Variables and Values

Enter Input Parameters

Link Input Parameter to an Object

Test Policy and upload to the Dashboard for distribution

 

Create a New Policy

1.Launch the Automation Manager
2.Create the policy:

 

Click New Policy in the north pane, or
Click the plus button in the menu bar, or
Go to File > New

 

3.Enter a descriptive Name
4.Provide information on its usage, parameter requirements... in the Description
5.OK to proceed

am_new_policy

 

 

Policy Workflow (add objects)

The policy workflow determines the objects (tasks) run sequence. Add objects to the policy in their execution order.

 

1.Browse or Search through the left Object pane for the target component
2.Drag and drop this object onto the Policy Builder frame where you want it to run in the policy

 

To display description and parameter information for the object in the right Help Panel (where enabled in the View menu). Highlight the object in the policy.

 

We will cover the objects required for this policy and the sequence they are entered:

 

1.Choose the Folder Exists object
2.Drop Folder Exists onto the policy between Input and Output

This object checks whether the given folder exists

 

3.Chose an If object
4.Drop If under Folder Exists in the policy

This object instructs the script to perform an action when the specific condition is met. Add the action object in the If component's Then field.

 

5.Choose the Create Folder object.
6.Drop the Create Folder object under If in the Then condition (Drop objects here)

This object creates a folder with the given path.

 

Drag and drop objects to reorder their sequence in the policy.

 

 

am_policy_add1am_policy_add2

 

 

 

Configure Variables and Values

After adding the objects to the policy, the next stage is to populate their variables and values.

 

Folder Exists

Identifies the folder to search for.

 

Input Parameter

 

Folder

Pre-populate the field to always check whether a specific folder exists or link the parameter to another object or Input Parameter. This field requires the full path to the folder.

 

In our example we will link this field to an Input Parameter entered by the Dashboard user.

 

 

If

Checks whether the specified folder exists.

 

Input Parameters

 

Variable

Click the link (chain) icon beside the Variable: field and select

 

Objects: Folder Exists

Output Parameters: Conditional

 

OK to save

 

Condition

Choose equals

 

Value

Enter False

 

Then

Triggers the Create Folder object where the specified folder does not exist.

 

Create Folder

Pre-populate the field to always check whether a specific folder exists or link the parameter to another object or Input Parameter. This field requires the full path to the folder.

 

In our example we will link this field to the Input Parameter entered by the Dashboard user.

 

 

 

If Object

Variable Link: Folder Exists

am_if_object

am_object

 

Enter Input Parameters

The parameters processed by the policy vary depending on the intended usage of the script. When using Input Parameters the user may be prompted to enter the parameters when configuring the script on the Dashboard as a Check or Automated Task.

 

Our example requires two Input Parameters to prompt the user to enter both the Folder Exists and Create Folder locations.

 

1.Click Input in the Policy Builder pane
2.Under the Input Parameters tab choose Add
3.Complete the Name, Display, Type and Value information for the Folder Exists parameter
4.OK to save
5.Repeat the operation to populate the Create Folder parameters

 

Field

Note

Folder Exists - Example Input Parameters

Create Folder - Example Input Parameters

Name

Variable name: cannot contain spaces and must be unique

CheckFolder

AddFolder

Display

The label of the field as it appears in the Dashboard

Check for this folder

Create this folder

Type

Choose the input type from the drop-down:

 

Date

Numeric value indicating a calendar date in the format mm/dd/yyyy hh:mm:ss

Number

Numeric value

Password

Security password

String

Alphanumeric character string

 

String

String

Value

The data input field. Leave blank, or pre-populated to provide an example for the user adding the Script Check or Automated Task.

e.g. C:\Users\John.Doe\Documents\My Projects

e.g. C:\Users\John.Doe\Documents\My Projects

 

 

Folder Exists - Example Input Parameter Dialog

Create Folder - Example Input Parameter Dialog

am_input_para

am_input_para2

 

 

Link Input Parameter to an Object

After creating the Folder Exists and Create Folder Input Parameters. The next stage is to associate these inputs with an object.

 

Folder Exists

1.Go to the Folder Exists object in the policy
2.Click the link button against Folder: field to open the Object Link dialog
3.Under Objects choose Input Parameters
4.In Output Parameters select the Folder Exists parameter (i.e. CheckFolder)
5.OK to save

 

Create Folder

1.Go to the Create Folder object in the policy
2.Click the link button against the Folder: field to open the Object Link dialog
3.Under Objects choose Input Parameters
4.In Output Parameters select the Create Folder parameter (i.e. AddFolder)
5.OK to save

 

Folder Exists - Example Object Link Dialog

Create Folder - Example Object Link Parameters

am_check_folder

am_add_folder

 

.

Test Policy and upload to the Dashboard for distribution

Once all the objects are added to the policy and the variables, values and parameters populated, the final stage is testing. Testing ensures the script will work as expected before uploading to the Dashboard and deploying across mutliple devices.

 

1.Test the policy locally

 

Click the play icon on the toolbar, or
Press Ctrl + F5, or
Go to File, Run

 

2.Enter Input Parameters where prompted
3.To stop the policy at any time before it completes

 

Click the stop icon on the toolbar, or
Press Shift + F5

 

To allow you to follow the policy's execution process it logs its results to the Output pane. Where problems are encountered they appear in the Errors section.

 

Use the Debug option, to execute the policy one component at a time to allow for easier reviewing. Implement Breakpoints to stop the policy at specific points.

 

 

If testing proves successful, the next steps is to save the policy locally (save icon on the toolbar or File > Save) then upload to the Dashboard for distribution.

 

1.Login to the Dashboard
2.Go to Settings
3.Script Manager
4.Click New, populate the required information and upload the script as a Windows Script Check or Automated Task

 

Automation Manager - Enter Input Parameters and Policy Output

Script Manger - Add User Defined Scripts Dialog

am_test_run

script_dialog_add

 

What do you want to do?

 

Launch the Automation Manager
View the Automation Manager Overview and learn about policy components (objects, control flow, parameters etc.)
Read more information on policy debugging
Learn about using custom PowerShell scripts in the policy
Discover how to edit a policy/.amp script
Download Default Automation Manager Policies
Upload a script to the Dashboard through the Script Manager
Deploy scripts as Checks or Automated Tasks