Solved

Active Directory

Posted on 2016-10-26
2
70 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 15

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

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

A procedure for exporting installed hotfix details of remote computers using powershell
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

821 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