Solved

Using a script to created AD account in Window server 2008

Posted on 2013-05-12
4
467 Views
Last Modified: 2013-05-17
Hello Everyone,

I need to setup a non IT user to create new accounts in a windows 2008 domain.  They will need to create two accounts for each user.  I am looking to streamline this as much as posslbie.  Does anyone know of a script that will prompt you to enter a username, password, and then create the user?

Thanks,

Bill
0
Comment
Question by:bjennings
  • 2
4 Comments
 
LVL 13

Expert Comment

by:imkottees
ID: 39160255
0
 
LVL 10

Accepted Solution

by:
Prashant Girennavar earned 300 total points
ID: 39160382
import-module activedirectory
$SamAccountName = Read-Host "Enter Logon Name"
$Password = Read-host "Enter the Password"
$FirstName = Read-Host "Enter First Name of the User account"
$LastName = Read-host "Enter Last Name of the User account"
$UserPrincipalName = $Samaccountname + "@contoso.COM"
New-ADUser -SamAccountName $SamAccountName -UserPrincipalName $UserPrincipalName -Givenname $FirstName -Name $FirstName -SurName $LastName -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -force) -Enabled $True -ChangePasswordAtLogon $True -PassThru

Open in new window


This script will prompt for each attribute , Please test it  and use it. (Make sure you run this script on a system which is a domain contorller or which has RSAT Installed in it)

Other resource you can refer.

http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Create-Active-7e6a3978
http://serverfault.com/questions/60992/how-to-create-active-directory-user-account-with-powershell

Thanks,

-Prashant Girennavar
0
 

Author Closing Comment

by:bjennings
ID: 39174876
THis worked great!  Thank you so much.
0
 
LVL 10

Expert Comment

by:Prashant Girennavar
ID: 39175008
No Problems.

Glad that it was useful for you.

Thanks,

-Prashant Girennavar.
0

Featured Post

Problems using Powershell and Active Directory?

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

Resolve DNS query failed errors for Exchange
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
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…

910 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

26 Experts available now in Live!

Get 1:1 Help Now