Jump to content

Recommended Posts

Posted

Hi,

It has come to the time of the year of Active Directory of creating and removing user accounts. We currently have a template user in each year and then just copy that user and change. This is very time consuming as having to do each user.

 

Does anyone know a way which will allow me to create users in AD in OU=###### from a spreadsheet?

 

The required fields that would need to be imported are:

 

First Name, Last Name, Username, Password, Email Address, ProxyAddresses (in Attribute editor) and finally setting security groups for the user to be a member of.

 

Does anyone know a way for this to be done?

 

Many thanks,

Matt

Posted
If the security groups are always the same for each user of a particular type, students in year 7 for example may always be in a generic all students and a year 7 group, then you can just use Add-ADGroupMember -Group -Members as part of the above powershell script and it will do that for you, I usually add start-sleep -s 5 between the new-aduser and anything using that account so it's got time to actually be created on the DC and begin replication.
Posted

Powershell is your friend!

 

Although usually I just copy the template user , putting in the new students name , next next next to complete wizard. This automatically creates home folder and puts permissions on the folder with security group etc.

 

Then just run an exchange powershell script which mail enables all users in that OU and set the mailflow/mailbox features for all the users.

 

Doesn't take long really.

Posted

Perhaps not perfect but a close script might be:

 

$pass=read-host -asSecureString "Password: "
$userlist=import-csv c:\Users.csv -Header forename,surname,username,email,proxyadd
$userlist | foreach {New-ADUser -Name $_.username -UserPrincipalName $_.username -GivenName $_.forename -Surname $_.surname -AccountPassword $pass -ChangePasswordAtLogon $true -Enabled $true -Path "OU=,OU=,DC=domain,DC=local" -HomeDirectory \\server\Users\%username% -HomeDrive H: -OtherAttributes @{proxyaddresses=$_.Proxyadd}}
$userlist | foreach {Add-ADGroupMember -Identity Groupname -Members $_.username}

Posted (edited)

Account Management Spreadsheet The download button is on the right.

 

I had to do this for 125 plus students. Instead of creating the csv file and messing with powershell. This allowed me to cut and paste, into the file and click on the button to add. I had to try a few times just to make sure everything was in order and then did the bulk add.

[TABLE=width: 1]

[TR]

[TD] Common-Name[/TD]

[TD] Account Name[/TD]

[TD] First Name[/TD]

[TD] Surname[/TD]

[TD] Initials[/TD]

[TD] Password[/TD]

[TD] User Principal Name[/TD]

[TD] Logon Script[/TD]

[TD] Results[/TD]

[/TR]

[TR]

[TD] Name you see in AD tree[/TD]

[TD] Logon name 2000[/TD]

[TD] First Name[/TD]

[TD] Last name[/TD]

[TD][/TD]

[TD][/TD]

[TD] User Logon Name[/TD]

[TD][/TD]

[TD][/TD]

[/TR]

[/TABLE]

 

There is a button at the top of the page that has options so you can click on what you need. Also make sure that you are either doing this in the server or on a machine that has Domain Admin privileges.

For Account name and User Principal name I used an equation in the cell. =(C2&D2) will equal to JOHNSMITH and for Common Name i used =(C2&" "&D2) resulting in JOHN SMITH (note the space).

The only thing I had to do was create the ou first in the server, then the excel file picked it up and from there all i had to do was copy the first name, paste, last name, paste and every cell was properly populated for me. Hit the Add Users button and I was done.

 

I hope this helps for the future if you are done with this for now. And you can google other cool things to do with excel to make this even faster.

 

Good luck!

Edited by JCovarrubias
  • Thanks 1
  • 2 months later...
Posted (edited)

PowerShell is good for such purposes but only in a relatively small environment and if you are not going to modify your workflow in any way. Otherwise it's going to quickly become a big pain to maintain all your scripts.

 

:mod: Advertising removed

Edited by elsiegee40

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...