0 votes

Hi we want to Copy the Master Data Location properties (Adress, Company, Country etc.) from one User to another User. Personal Data like Name, Mailadress, Groups should be not copied. So if a User will switch to another Location, he should get all things from there. Would be good, if it's possible to choose the Source User from a Search and also the Target User.

We have a copy and paste Script (PS) Button from here for Groups, that works like a charm and I hope someone can give us something similar just for properties.

Thank you in advance Marcus

by (20 points)

1 Answer

0 votes
by (12.5k points)

Hello,

To achieve the required, you can create a custom command with the Directory object picker parameter. The parameter will be used to select the user to copy the property values from. Then add the Run a program or PowerShell script action executing the below script. The script will copy property values from the user specified in the command parameter to the user on which the command is executed. In the script:

  • $paramName – Specifies the name of the parameter used to select the user to copy property values from. The variable value must start with the param- prefix.
  • $propertiesToCopy – Specifies the properties of the source user whose values will be copied.
$paramName = "param-CopyFrom" # TODO: modify me
$propertiesToCopy = @("streetAddress", "company", "c") # TODO: modify me

# Bind to the source user
$sourceUserDN = $Context.GetParameterValue($paramName)
$sourceUser = $Context.BindToObjectByDN($sourceUserDN)

# Update properties
foreach($propertyName in $propertiesToCopy)
{
    try
    {
        $propertyValue = $sourceUser.Get($propertyName)
    }
    catch
    {
        continue
    }

    $Context.TargetObject.Put($propertyName, $propertyValue)
}

# Save changes
$Context.TargetObject.SetInfo()

Then you can create a Web interface action executing the custom command. For details on how to create Web interface actions, have a look at this tutorial: https://www.adaxes.com/help/ConfigureActionsPane.

0

Thank you very much, looks good but so it will copy the parameters to my own User, or? I want to choose also the Target User. For Groups we have a Copy User action and a Paste User Action inside helpdesk, for both we can select ( pick up) a User.

0

Hello,

The property values will be copied to the user on which the custom command is executed. You can create a Web interface action to copy property values. In this case, you will need to select the user on which the command will be executed first, and then the user to copy property values from.

Related questions

0 votes
1 answer

goal is to copy groups from one user to another during the crete user process. I created a variable on the create user form to input the UPN of the ... primaryGroupToken") -eq $primaryGroupId) { continue } $group.Remove($Context.TargetObject.AdsPath) } }

asked Nov 30, 2021 by Derek.Axe (480 points)
0 votes
1 answer

We have several contractors that come and go, it would be helpful to have a custom command that will copy only the member of groups from one user to another. We have done this previously with ... ; write-warning "I'm sorry, Jay. I'm afraid I can't do that." }

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

Hello Back when we first started using Adaxes you created a couple of great scripts which worked together really well, the first one copied one users group membership and put in ... an addition to what groups the second user is already a member of? Thank you.

asked Aug 4, 2015 by CBurn (700 points)
0 votes
1 answer

Hi, Group memberships are kept when using "User Copy" function. Is it possible to do the same thing between two existing users ? (custom commands or else) Thanks for your response, Yoann

asked Oct 4, 2012 by yoann.hamon (180 points)
0 votes
1 answer

Hello I am trying to set up a script to copy the 'Members Of' from specific accounts to a new user account after creating the user. Something very similar to this: https:/ ... to the ever changing nature of the business. Is someone able to help me with this?

asked May 28, 2020 by adantona (40 points)
3,434 questions
3,130 answers
7,984 comments
546,353 users