Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a need to duplicate a Windows 2003 server's local user accounts on another Windows 2003 server. As I'm a UNIX guy I'm a bit lost (on a UNIX system I'd just copy the relevant /etc/passwd, /etc/shadow, and /etc/groups lines and it'd be done). Ideally the copied users would have the same passwords as the originals. ACLs/etc aren't a big deal in this case.

Found some stuff online for migrating 2003->2008, and references to a tool called AddUsers, but the Resource Kit download doesn't seem to include that any more.

Hints?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

This is definitely not AD accounts right?

I do not know away to export users AND passwords unless you use a tool like jack the ripper or something. The equivalent to /etc/shadow is c:\windows\system32\config\SAM - you need a special utility to read from it though.

My prefered method would be to export a list of users in the gui and set some passwords later.

You can export a list of users like this:

  1. click start,right click my computer, select manage.

  2. In the left pane, expand system tools, then local users and groups.

  3. In the left pane select users then in the right pane, right click in empty space and select export list and select CSV as the file type.

You could then use some manipulation in excel to make a text file full of "net user" commands to paste into a command prompt. To add one user using "net user":

net user username_here password_here /add

or you can get net user to spit out a random password like so:

net user username_here /add /random /passwordchg:yes

...which will output a random password and force the user to change password at next logon.

However, my preference would be to use a for command (which is similar but nowhere near as good as the for command in bash) and the "net user /add" command. You can use this to iterate through a csv file, firing net user commands like so:

for /f "delims=, tokens=1,2" %a in (c:\yourcsvfile.csv) do net user %a /add /fullname:"%b" /random /passwordchg:yes >c:\passwords.txt

This will use a CSV file with column one as the username, column two as the full name of the user and randomly set a password and output the results to c:\passwords.txt

For more info open a command prompt and type: for /? net user /? net localgroup /?

Or open the windows help center and search for "net user", then find it under "Help Topics".

If you are using AD, look at dsadd and dsquery.

share|improve this answer
    
oh forgot to say... I haven't tried that for loop so you may want to double check it's syntax. –  simon Nov 8 '10 at 19:25
    
Definitely not AD, unfortunately. Thanks for the suggestion and I'll give that a go. –  Matt McLeod Nov 8 '10 at 23:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.