0 votes

Using a custom command I am trying to move a user based on a template's OU. I imagine I have to use a script instead of a the built in move? I found a script in your repository that moves the user to the user's manager but I need to use template user's ou. the Parameter is param-Template.

by (500 points)


Yes, you are right, it can only be done using a script. What exactly do you mean by template’s OU? Do you need to move the target user to an OU where a user selected in the parameter is located? What is the type of the parameter? Any additional details (e.g. screenshots of the custom command) will be much appreciated.


The parameter is an AD object picker which (when completed) will only allow the user to pick from a list of user accounts we use as templates. Yes we want to move the user based on the template user's current OU.


1 Answer

+1 vote
by (244k points)


Thank you for specifying. You can use the following script:

# Get the container where the manager is located
$templateDN = New-Object Softerra.Adaxes.Ldap.DN "%param-template%"
$templateParentDN = $templateDN.Parent

if ($managerParentDN -eq "%adm-ParentDN%")

# Move the user
$targetContainer = $Context.BindToObjectByDN($templateParentDN)
$targetContainer.MoveHere($Context.TargetObject.AdsPath, $NULL)

Related questions

0 votes
1 answer

Can I edit my buisiness rule from "after creating a user" to "after moving a user". I wanted to move 120 business rules and not have to recreate each one, one by one. Maybe there is a powershell script or something?

asked Oct 12, 2022 by raul.ramirez (210 points)
0 votes
1 answer

I have setup a form to allow HR to edit some details on AD accounts. Currently the scope is limted to only AD object under one pre-chosen OU. The other option is an ldap filter. How can I allow this action to display user accounts from two seperate OU

asked Nov 18, 2019 by ice-dog (170 points)
0 votes
1 answer

Currently, when I disable a user account in Adaxes, the group memberships of the user remain intact. I'd like to automate the removal of group memberships such as distribution ... a list of groups/DL that the user was previously in and removed from. Thanks!

asked Nov 3, 2021 by jayden.ang (20 points)
0 votes
1 answer

When we deprovision a user the member of groups are deleted and the power shell scrips only runs as removing all memberships. I can't see what was removed. Is there a scrips I can run prior to removing those memberships that will e-mail what they are?

asked Oct 15, 2019 by meyerm (50 points)
0 votes
0 answers

We are looking for a tool that can support a blacklist for password resets and that will enforce this blacklist to certain OU groups but not others, or potentially use a whitelist of users that it will not be enforced upon.

asked Mar 2, 2020 by zachThankYou (20 points)
2,993 questions
2,712 answers
203,610 users