[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to write script for creating users automatically(altogether) in windows 2000 server domain?

Posted on 2006-04-23
7
Medium Priority
?
278 Views
Last Modified: 2012-08-13
Hi...
We rebuilt our PDC...Now we want to create all users through script...

how to write script for creating user in windows 2000 server domain?
What is the syntax?

For eg: User name is "Joji Joseph" and logon ID should be "joji" in group IT

Awaiting ur quick reply...

Thanks...
Joji
0
Comment
Question by:JojiJoseph_1975
  • 3
5 Comments
 

Accepted Solution

by:
Tecki_Trojans earned 500 total points
ID: 16520682
Hello Bro
Let me know if this works for u .....................


' Taken from ADS_USER_FLAG_ENUM
Const ADS_UF_NORMAL_ACCOUNT = 512

set objParent = GetObject("LDAP://<ParentDN>")
set objUser   = objParent.Create("user", "cn=<UserName>") ' e.g. joes
objUser.Put "sAMAccountName", "<UserName>"   ' e.g. joes
objUser.Put "userPrincipalName", "<UserUPN>" ' e.g. joes@rallencorp.com
objUser.Put "givenName", "<UserFirstName>"   ' e.g. Joe
objUser.Put "sn", "<UserLastName>"           ' e.g. Smith
objUser.Put "displayName", "<UserFirstName> <UserLastName>" ' e.g. Joe Smith

' CORRECTION: If you don't set userAccountControl, then by default
'             the value of 514 (normal account + disabled) will be set for it.
'             In this instance by setting it to 512, the account will not
'             be disabled, and if you have password complexity enabled in
'             your forest, the script will fail because a password was not
'             set prior to the account being enabled.  The solution is to
'             not set userAccountControl here.
' objUser.Put "userAccountControl", ADS_UF_NORMAL_ACCOUNT

objUser.SetInfo
objUser.SetPassword("<Password>")
objUser.AccountDisabled = FALSE
objUser.SetInfo


Enjoy ..........
0
 
LVL 10

Assisted Solution

by:GuruGary
GuruGary earned 500 total points
ID: 16521365
Are you trying to automate adding a bunch of users at one time?  This will do one at a time ...

For a batch file, you could use the "net user" and "net group" commands to accomplish your task.  For example, if you want to use it to set up the 3 fields you entered above (with an initial default password of "password"), you could save the following as "userscript.bat":

@echo off
net user %2 password /add /fullname:%1
net group IT %2 /add

Then just run it like:
userscript "Joji Joseph" joji IT
0
 
LVL 6

Expert Comment

by:Dark_King
ID: 16523458
0
 
LVL 6

Expert Comment

by:Dark_King
ID: 16523529
If you dont have "Resource Kit for Windows 2000 " you can download Add Users from here.
http://www.dynawell.com/support/Reskit/win2k.asp
0
 
LVL 6

Expert Comment

by:Dark_King
ID: 16523557
Sorry for the wrong writing in last post.

If you don’t find your "Resource Kit for Windows 2000" you can download Add Users from here.
http://www.dynawell.com/support/Reskit/win2k.asp
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello I read in a discussion about a person who configured a very simple mirror RAID with two hard drives; the system and data were on the same partition. He asked how to repair the system as it was not booting up anymore. In his case running …
I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question