Solved

Using a script to created AD account in Window server 2008

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

830 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