MrFrostmaul Posted July 15, 2015 Posted July 15, 2015 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
sted Posted July 15, 2015 Posted July 15, 2015 yes to all but the proxy address (and that might be doable its just one ive never come accross. probably not the latest version but i dont think ive changed much recently just added the ability to go a few more ous deeper users using dsadd v3 inc dollar.xls
jamesb Posted July 15, 2015 Posted July 15, 2015 Powershell will let you do this. PowerShell: Bulk create AD Users from CSV file - TechNet Articles - United States (English) - TechNet Wiki That'll give you some sample code, and a bit of playing around will give you the other attributes you want as well. A list of security groups can even be added as a column in the csv with a foreach loop to add the user to each one if you wanted to.
halbaradkenafin Posted July 15, 2015 Posted July 15, 2015 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.
ITGURU Posted July 15, 2015 Posted July 15, 2015 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.
themightymrp Posted July 15, 2015 Posted July 15, 2015 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}
Geoff Posted July 15, 2015 Posted July 15, 2015 Don't reinvent the wheel, there's a Powershell script on the Technet Gallery you can use for this. https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Create-Active-7e6a3978
MrFrostmaul Posted July 15, 2015 Author Posted July 15, 2015 Many thanks from everyone - Will try the different ways etc. .
JCovarrubias Posted July 22, 2015 Posted July 22, 2015 (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 July 22, 2015 by JCovarrubias 1
kuingul Posted October 13, 2015 Posted October 13, 2015 (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. Advertising removed Edited October 13, 2015 by elsiegee40
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now