Solved

Using a script to created AD account in Window server 2008

Posted on 2013-05-12
4
471 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

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 article will help you understand what HashTables are and how to use them in PowerShell.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

778 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