Solved

Active Directory

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

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
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…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

744 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

13 Experts available now in Live!

Get 1:1 Help Now