Avatar of csehz
Flag for Hungary asked on

Windows Servers - Copy user

Dear Experts,

Can you please advise is there maybe DS tool command so like dsadd to copy and Active Directory user?

Basically for dsadd would be needed all of the memberships of the user, and so a copy of an existing one could be much faster.

Active DirectoryWindows Server 2003Windows Server 2008

Avatar of undefined
Last Comment
Krzysztof Pytko

8/22/2022 - Mon
Joseph Daly

You can do a copy of an existing user from within the GUI of active directory users and computers.

As far as the DS command line tools go there is no single command to let you create another user as a copy of an existing user.

You could probably script this out using multiple DS commands but to answer your question there is nothing like DScopy.

Do you mean copy a user from one Active Directory to another?  Otherwise if it's the same AD just go to ADUC, right-click and copy..

Thanks the answers,

Yes I supposed that maybe something can be existing as DScopy.. But so in this way not existing.

In AD doing this right-click copy of course actually, but thought that for multiple users copy could be something like this
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Krzysztof Pytko

Please check an article about DSADD on my blog at

and try to follow this way. In case of any further questions, do not hesitate to ask. We will help you

Krzysztof Pytko

OK, you can do that this way. Create a text file with user's data, i.e.


save this on C-Drive as c:\newusers.txt

and use this syntax:

for /f "tokens=1-3 delims=;" %i in (c:\users.txt) do dsadd user "cn=%i,ou=OULocation,dc=domain,dc=local" -samid %i -fn %j -ln %k -display "%j %k" -upn %i@domain.local -pwd P@ssw0rd -memberof "cn=group1,ou=GroupLocation,dc=domain,dc=local" "cn=group2,ou=GroupLocation,dc=domain,dc=local" -mustchpwd yes -disabled no

Open in new window

where "cn=group1,ou=GroupLocation,dc=domain,dc=local" is a reference group of existing user (from his memberOF tab). To simply get DN of that group, type in command-line

dsquery group -name "Group1"

Open in new window

and use the output :D


Krzysztof thanks, do you mean that this method assumes that all of the group membership is downloaded for the copy from user and also listed in the command?

Because the issue is that these sample users have a lot of group membership, so if those should be listed in the command, then that one does not sound too easy.

As I can imagine maybe so before anything such command should be

dsget user "CN=Joe Doe,OU=Users,OU=MM,DC=it,DC=corp,DC=local" -memberof > c:\users\myuser\desktop\groups.txt

and after having all group membership, continue with your way?

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Krzysztof Pytko

Ok, now I know what did you mean. Yes, we can achieve that using DSTools but we need also file with groups. Give me short time and I will give you a syntax, now I'm on mobile and it is difficult to write ;)

Krzysztof Pytko

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Krzysztof thanks just again, all of my point is yours :) It is really not so important that you dealt with it even in the evening.

Yes absolutely I thought like this so firstly identifying all groups, basically we are just preparing to the future with this when would get mass user creation requests. So will try to test these steps first

Krzysztof Pytko

Hi Zsolt,

you're welcome :)

Yes, this is good idea to prepare a process for that and test it first to avoid any issues in the future.

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck