Solved

Active Directory

Posted on 2016-10-26
2
67 Views
Last Modified: 2016-11-01
Hi, I need a script to create users in Active Directory. I have some 1000 users which I need to be created in our active directory. Can any expert help me out with the script. AD is having OS Windows 2012 R2 standard edition.
0
Comment
Question by:SYZH
2 Comments
 
LVL 1

Assisted Solution

by:Erik D'antoni
Erik D'antoni earned 250 total points
ID: 41860674
0
 
LVL 14

Accepted Solution

by:
Todd Nelson earned 250 total points
ID: 41860792
Basically, create a CSV file and use with script.  Here are a couple of references.  The last two, in part, will guide you to creating a CSV file and the users...


Essentially, the CSV file (saved as 'MyNewUsers.csv') and script will look similar to this...

Name,UserPrincipalName,DisplayName,FirstName,LastName,OUPath,EmailAddress
User0,User0@mydomain.local,User 0,User,0,"OU=Test,OU=Users,DC=mydomain,DC=local",user0@mydomain.com
User1,User1@mydomain.local,User 1,User,1,"OU=Test,OU=Users,DC=mydomain,DC=local",user1@mydomain.com
User2,User2@mydomain.local,User 2,User,2,"OU=Test,OU=Users,DC=mydomain,DC=local",user2@mydomain.com
User3,User3@mydomain.local,User 3,User,3,"OU=Test,OU=Users,DC=mydomain,DC=local",user3@mydomain.com

Open in new window


Import-Module ActiveDirectory
$MYPASSWORD = Read-Host "Enter Password" -AsSecureString
Import-Csv "C:\MyNewUsers.csv" | ForEach-Object {
     New-ADUser -Name $_.Name -UserPrincipalName $_.UserPrincipalName -DisplayName $_.DisplayName -GivenName $_.FirstName -Surname $_.LastName -Path $_.OUPath -Email $_.EmailAddress -AccountPassword $MYPASSWORD -PasswordNeverExpires $False -Enabled $True
}

Open in new window

1

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
A brief introduction to what I consider to be the best editor for PowerShell.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

770 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