Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Active Directory

Posted on 2016-10-26
2
Medium Priority
?
77 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
[X]
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
2 Comments
 
LVL 1

Assisted Solution

by:Erik D'antoni
Erik D'antoni earned 1000 total points
ID: 41860674
0
 
LVL 16

Accepted Solution

by:
Todd Nelson earned 1000 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

670 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