0 votes

Hi,

we use the rule "Before adding a user to group" for approval workflow on the groups OU. How can we skip this rule if the added user is located under a special OU?
The added user is not the initiator.
We use Win 2008 R2 and Adaxes 2012.1 latest fix-release.

Regards

by (3.6k points)

1 Answer

0 votes
by (19k points)
selected by
Best answer

Hello,

You can use the If PowerShell script returns true condition:

  1. Right-click the Send operation for approval action and click Add Condition in the context menu.

  2. Select the If PowerShell script returns true condition in the list.

  3. Paste the following script to the Script edit box.

     $Context.ConditionIsMet = $True
    
     $OUDN = "OU=Sales,DC=company,DC=com" # TODO: modify me
    
     $newMember = $Context.BindToObjectByDN("%member%")
     $memberOUPath = New-Object "Softerra.Adaxes.Adsi.AdsPath" $newMember.Parent
    
     if ($memberOUPath.DN -ieq $OUDN)
     {
         $Context.ConditionIsMet = $False
     }
    
  4. Modify the script: set the distinguished name (DN) of your Organizational Unit to the variable called $OUDN.
    To get the DN of an Organizational Unit:

    • Right-click the OU you need in the Console Tree (Adaxes Administration Console).
    • In the context menu, open the submenu of the Copy item.
    • Click Copy DN. The DN of the selected OU will be copied to the clipboard.
0

Hello Eugene,

Thank you very much. It works!
The

$newMember = $Context.BindToObjectByDN("%member%")

was the missing twist. ;)

Related questions

0 votes
1 answer

I'm building my first rule to license users in Office365. When the rule runs it fails to find the Usage Location which is based on the Country (default settings). I ... runs before the "assign 365 license" rule. Why am I not getting Usage Location populated?

asked Jul 20 by ComputerHabit (2.6k points)
0 votes
1 answer

I would like to add the following logic into a Powershell script that will be triggered on 'After Create User'. Read the value of the 'title' property of the user just created ... 'True' or 'False'. Could you assist with how to script this please? Many thanks.

asked May 1 by Bernie (1.8k points)
0 votes
1 answer

My scheduled task currently: Checks for staff in a particular OU that do not have an O365 license Adds a license Resets their AD Password Moves them to an OU based off ... scheduled task moves them out of the OU that the business rule is looking at. Thanks

asked Apr 15 by russmerriman (450 points)
0 votes
1 answer

We would like to create a ticket in our ticketing system after a user's account is unlocked. I would like to use a business rule to do this so that it happens automatically. I don't see an option for this. I only see "After updating a user:"

asked Feb 4 by mark.it.admin (3.9k points)
0 votes
1 answer

Hello *, we are struggling with a behavior with action groups in business rules. For example: So my questions are: 1. In what order will the groups be executed? Really the ... on triggering completey for the rule, aren't they? Thanks in advance for your help!

asked Aug 22, 2019 by ahanil (970 points)
2,245 questions
2,007 answers
5,494 comments
19,928 users