RG03D – Runbook Parameter Linking

By Patrick Kaak


 In the previous article RG03A I showed you how to utilize the RES Automation Manager to create a user logon name with a counter. This time we are going to use that created username and make a home drive for this user. We are going to do this by transporting the created username back to a runbook/project and into another module that will create the home drive. Keep in mind that you need to have RES Automation Manager 2011 SR2 for this as we want to get the value back when the jobresult is ‘finished with errors’ (standard behavior in AM2011 SR1 is to not return a parameter value when there was an error in the module/job).

At the end of this article, you will find a building block of the entire setup, which you can try out in your own lab/test environment.


The create-homedrive module

First we create the ‘create home drive’ module. Add a new module and give it a nice name like ‘create a homedrive’. Go to the module parameters tab and add a new parameter. Give the parameter the name ‘UserLogonname’ and make it to ask the parameter when scheduling and hide it when the parameter is not used directly.

Now open the Tasks tab and create a new task ‘Configuration – Files – Perform operations’.  Add a new action ‘Create Folder’ and type the path where to create the folder in, like ‘d:\Data\HomeDirs\’.  Use the right drive letter as available on the fileserver where your home drives reside. There must be an RES AM agent on this server, to schedule the task to it.

Place the cursor behind the last ‘\’ in the path and insert the UserLogonName-parameter (by right clicking on the path -> Insert parameter -> $[UserLogonName] ).

Click Ok and again OK to close the ‘Perform file operations’-task. Now add a new task to this module to set file permissions ( Security – File Permissions – Set). Use the same folder as in the ‘create folder’-task and uncheck the ‘Remove all existing permissions’ (to prevent deleting the standard file permissions of the parent directory, like full control for administrators).

Click ‘Add Entry’ In the ‘Add entry’ dialog box, choose the UserLogonName-parameter (with right click), choose ‘full control’ and ‘Add access allowed’ 

Now click Ok -> Ok (to close the Folder permissions screen) -> Ok (to close the module). The new module is now ready to use. You can try the module to see if everything works. Schedule the module on the file server, use a testuser logon name as parameter input. Check if the correct directory is created and that the testuser has full control to it.


Runbook parameter linking

We are now going to create a runbook which uses both modules (‘Create a domain user’ and ‘Create a Homedrive’) and use the created user logon name in the first module to feed the second module.

Create a new Runbook and give it a good name like ‘Create user and homedrive’. Go to the Jobs-tab and choose to add a new job.  In the next window, choose ‘What’ and select the ‘Create a domain user’ task. At the ‘Who’ field, add the domain controller. In the bottom, select ‘Continue Run Book on Error’ in the ‘Error control’ field. Click Ok to accept the job. We need to set this, because we need the Run book to go forward when this job has the result ‘finished with errors’.

Add a second job, select the ‘Create user homedrive’ and select the fileserver to run the job on. Leave the error control on the default value ‘stop run book on error’.

Now the two jobs are inserted in the Run Book, choose the tab ‘Run Book Parameters’ and click on the AutoCreate button. RES Automation Manager now creates all parameters available in the jobs just made. Delete the ‘Counter’-Parameter. Edit the UserLogonName-parameter. Empty the value on the properties tab. Go to the Links tab. Right click on the ‘Create User Account’-Job -> Action -> Get final value.

Rightclick on the ‘Create home drive’-job and select ‘Set initial value’. The result should be as shown here on the right.

Clik Ok to get back to the Run Book parameters tab. Click on the Links tab, it should look like this ->

Let’s summarize what do we have built so far: We have two jobs in our Run Book, running on different (or the same) server. When the ‘Create user account’ job runs, it creates a User logon name. After it has run, the last value of the UserLogonName-parameter from that module is transferred to the Run Book. The Run Book starts the ‘Create Homedrive’ job and gives the just received value of the UserLogonName to this job, so it creates a homedrive based on the just created user logon name.

Now we only have to deal with the first job when it returns with a ‘failed’ result. For this we put a condition on the ‘create home drive’ job. In the ‘Jobs’ tab of the Run Book, click on the second job and choose ‘Condition’. Create a new condition ‘Status of previously executed Job <> Failed’. If condition is TRUE then Executed job and if the condition is FALSE then Skip this and all other jobs. If you ever created other jobs in the same Run Book (ex. Create Mailbox) than that task is also skipped when the creation of the user has failed.


End Result

When we now execute the Run Book and give same information like firstname, lastname, telephone number, etc., the Run Book first creates the user account and after this, the homedrive. When you look in the finished task you will see something similar to this.


Refer to the nunbers below:

  1. Shows the ‘create user’-task running. It tries to create the user 5 teams before it managed to find a username that is not in use.
  2. The settings used to create the user. See the user logon name is DuckK5
  3. Notice the counter showing the number 5. This results in the UserLogonName becoming Duckk5
  4. he job parameter is given to the ‘create homedrive’ job. It has the return value of the ‘Create User’-job.

Last but not least, if you would like to try this out without the fun of building it yourself, please feel free to try out the readymade Automation Manager buildingblock that will create all of the above for you.

Click the brick to download:


No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.