Solved

Add User and Computer Objects Script

Posted on 2010-09-02
11
868 Views
Last Modified: 2012-05-10
Does anyone have a good script to create user and computer accounts on a Windows 2003 AD domain? I used to have one but cannot seem to find it.
0
Comment
Question by:BoxunloX
  • 2
  • 2
  • 2
  • +4
11 Comments
 
LVL 39

Accepted Solution

by:
Krzysztof Pytko earned 42 total points
ID: 33594144
I would suggest to use dsadd command on server or workstation with Administrative Tools installed

create a bat or cmd file for each department and place there

@echo off

dsadd user "cn=%1,ou=<location_of_userr_OU>,dc=<your_domain>" -samid %1 -upn %1@<fqdn> -fn %2 -ln %3 -display "%2 %3" -pwd Password -desc <description> -memberof "CN=<group_name>,OU=<OU_group_location>,DC=<domain>" -hmdrv <drive:> -hmdir <home_directory_%1> -loscr <logon_script> -mustchpwd yes -canchpwd yes -disabled no

Then run script with 3 parameters 1- login, 2-First Name, 3- Last Name

if you need more assistance, just let me know
0
 
LVL 4

Assisted Solution

by:goyal_251
goyal_251 earned 42 total points
ID: 33594147
0
 
LVL 11

Assisted Solution

by:elbereth21
elbereth21 earned 42 total points
ID: 33594153
It's been a long while since the last time I used it, but I used to like this one: http://www.tek-tips.com/viewthread.cfm?qid=1185348&page=1
Anyway, use it carefully, since today I cannot test it myself.
0
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 33594186
oh, I missed part of adding computer :)
You can do that using

dsadd computer "cn=%1,ou=<location_for_computer>,dc=<domain>"
0
 
LVL 4

Assisted Solution

by:Malajlo
Malajlo earned 41 total points
ID: 33594420
AddUsers.vbs

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
    ("C:\users.xls")
intRow = 2
Do Until objExcel.Cells(intRow,1).Value = ""


    Set objOU = GetObject("ou=a, dc=your_domain, dc=inet ,")


    Set objUser = objOU.Create _
        ("User", "cn=" & objExcel.Cells(intRow, 1).Value)
    objUser.sAMAccountName = objExcel.Cells(intRow, 2).Value
    objUser.GivenName = objExcel.Cells(intRow, 3).Value
    objUser.SN = objExcel.Cells(intRow, 4).Value
    objUser.AccountDisabled = FALSE
    objUser.SetInfo
    intRow = intRow + 1
Loop
objExcel.Quit

Excel structure:
CN (description)      Username      Firstname      Lastname      password
Demo User            UserU      Demo      User      password123


0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 5

Expert Comment

by:Da_Pirate
ID: 33594498
I Agree with iSiek using TXT file to create a script then save it as .bat file
and
you must create you own script because os OUs name , Domain Name , Password...etc
0
 
LVL 5

Assisted Solution

by:Da_Pirate
Da_Pirate earned 42 total points
ID: 33594505
or just use Templates for creating users if they are too many
0
 
LVL 11

Assisted Solution

by:Ben Personick
Ben Personick earned 41 total points
ID: 33602195
I just finished a script to add users from a CSV File, of course the engineer who built the CSV file did it all wonky, and instead of fixing the CSV file I fixed the values in the batch file, If this ticket is still open when I look back I'll post that code and the format for the CSV.

~Q
0
 
LVL 1

Author Comment

by:BoxunloX
ID: 33731591
Thanks guys! I have been so busy I have not gotten to try these scripts yet. I will make it a point to get them tested this week and let you guys know the results.
0
 
LVL 1

Author Closing Comment

by:BoxunloX
ID: 35335565
All great solutions that will work for the problem I was encountering.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now