Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Add User and Computer Objects Script

Posted on 2010-09-02
11
870 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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
 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
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…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

861 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