UMRA If Then Else Tips

If you haven’t already, please read my first post on where and how to download a trial version of User Management Resource Administrator, developed by tools4ever.

Download Trial Version of UMRA à http://www.tools4ever.com/download/

In my first blog, I talked about how I was able to run a MASS project, to quickly update/get/create an active directory object. My script was simple, and didn’t have a lot of logic built into it. However, after poking around a bit in the “scripts” section of UMRA I found a few very powerful script actions, the main one we are going to talk about is the “If-Then-Else” Action with a few “No operation” Actions. These actions will allow us to really put some logic into our scripts, and have them do more then just run top to bottom. We will now be able to check conditions, such as: If the user’s description = xxxxx do this, if it doesn’t do that….

These actions are found in tree Variable actions à ProgrammingHere is a quick break down of how an “If-Then-Else” statement works. Like most scripts, you can check a condition; it can be a numeric value, strings, date range and a few others. How can you use this…you ask? You can now run CSV, database, or network data through your script, and check values in Active Directory. For Example, if we have a CSV of userdata, and there description for a Human Resources (HR) system, we can now say something like this:

IF = User in Active Directory Description = CSV User DescriptionTHEN = Don’t Update AccountELSE = If it’s different Update Account

This is how most “If Then Else” equations work, we first check the condition, if it matches, jump to another part in the UMRA script, if it doesn’t match, let go to an “update user” section in the script. Here is a quick visual representation on how it works.


If you are wondering what the “Get User (AD)” and “Get attribute (AD)” Actions are in the UMRA script, please see my first post Basics of UMRA.

So how has this 1 simple Action helped me? With “If Then Else” equations in my scripts I am now able to add logic into my script, I can now check conditions, as if I were doing this by hand, and only run cretin parts of my script. So I hope this helps some of you out there getting your feet wet with UMRA. My next blog post will be on Using the “Map Variable” action.

0 comments:

Post a Comment