0 votes


I came across this in the SDK for setting the OU in a Business Rule before object creation

$destOU = $Context.Action.TargetContainer

if ($destOU.AdsPath.Contains("Marketing Users"))
$newDN = "OU=Marketing Department,DC=company,DC=com"
$newDestOU = $Context.BindToObjectByDN(newDN)
$Context.Action.TargetContainer = $newDestOU

I have tried to use this in a BR Before Creating a Group to set the OU based in the initiator, however I get the error:

Property 'TargetContainer' cannot be found on this object; make sure it exists and is settable.

Will this not work on a group? Ideally I want to set the OU before creation, rather than create it then move, is there a way?


by (390 points)

1 Answer

0 votes
by (215k points)


No, it is impossible to replace the OU where a new group will be created with the help of a script. We suggest that you move newly created groups after they are created with the help of a Business Rule. For examples on how to accomplish this task, take a look at the following tutorials:

Related questions

0 votes
1 answer

Hi, we need to create some form (or custom command?) so managers of distribution groups can add/remove/change alias address. Primary and secondary. Distribution groups are ... contains list of current aliases with possibility to edit them... Thank you Sebela

asked Nov 18, 2019 by KIT (520 points)
0 votes
1 answer

Hello dear ADAXES community, what i wanted to do is, to have a custom report which does the following: get every group in a specific OU (the OU comes from an adaxes custom ... Add($Group.name) } } is this possible in such a way? thank you for your help

asked Sep 23, 2020 by m_st (200 points)
0 votes
1 answer

Is it possible to for security groups that are nested under an OU to inherit that OU's 'Managed By' value? I'd like to grant the OU Owner rights to the security groups ... option is to manually edit each group one by one. Is there a script that automates this?

asked Mar 26, 2020 by sirslimjim (430 points)
0 votes
1 answer

We have a need to set a group that is not domain users as the primary group. Is there an action we can do on a selected user to check the group we want as the primary group to that selected group?

asked Dec 20, 2017 by willy-wally (3.2k points)
0 votes
1 answer

I have a need to remove certain users from "Domain Users" and set their primary group to a custom one. I can't seem to find anyway in Adaxes to set a primary group. ... 't remove the user from their primary group. Running on 2011.1 trial version at the moment.

asked Apr 26, 2011 by Rojs (90 points)
2,803 questions
2,535 answers
62,200 users