MadSmiler Posted July 21, 2016 Posted July 21, 2016 Hi, I am currently trying to bulk add the new year 7's into the AD. As I have never done this before i am having some trouble performing this 'simple' task. I have created a .CSV file with the list of names in the following order - forename - surname - display name - username - password. I have then tried to use active directory powershell to execute this command - Import-Csv .\test.csv | New-ADUser -Enabled $True -AccountPassword (ConvertTo-SecureString Pass123 -AsPlainText -force) -ChangePasswordAtLogon $True But what ever i do it just doesn't seem to work. Any help would be appreciated Thanks Alex
FN-GM Posted July 21, 2016 Posted July 21, 2016 If all else fails you could give this a try. Makes life easier with imports. - Account Management Spreadsheet 1
howartp Posted July 21, 2016 Posted July 21, 2016 Hi, I have then tried to use active directory powershell to execute this command - Import-Csv .\test.csv | New-ADUser -Enabled $True -AccountPassword (ConvertTo-SecureString Pass123 -AsPlainText -force) -ChangePasswordAtLogon $True Does this PC/server have the ActiveDirectory module installed and registered? Try: import-module ActiveDirectory My command is as follows: New-ADUser -Name $AcName -DisplayName $DisplayName -GivenName $_.givenName -Surname $_.sn -SamAccountName $AcName -UserPrincipalName $AcName -EmailAddress $_.mail -Path "OU=ParentUsers,DC=scraven,DC=internal" -PasswordNeverExpires $True -AccountPassword (ConvertTo-SecureString $PassWord -AsPlainText -force) -Enabled $True -AccountExpirationDate $Expiry
sted Posted July 21, 2016 Posted July 21, 2016 and are you running powershell as am=dministrator as iirc it fails as a normal user (and what version of server 2012r2 i dont think needs the module adding if youre on a dc 2008r2 iirc does)
Rob_D Posted July 21, 2016 Posted July 21, 2016 I always used csvde commands (run on the DC). Has worked fine in the past. https://technet.microsoft.com/en-us/library/cc732101(v=ws.11).aspx Also you need to make sure your csv has the right column header names and formatting (also covered in the technet article). You will probably need something similar if you use powershell. Hope this helps.
enjay Posted July 21, 2016 Posted July 21, 2016 I have an Excel spreadsheet where I enter the names and year group, let it concatenate everything and produce lots of command lines, which I then save into a PowerShell script. The command line looks like this: New-ADUser -Name "TMay" -AccountPassword (ConvertTo-SecureString "Monday123!" -AsPlainText -force) -Description "Student User" -DisplayName "Theresa May" -Enabled $True -GivenName "Theresa" -HomeDirectory "\\school.schoolname.org.uk\Shared\StuHome$\TMay" -HomeDrive "N:" -SAMAccountName "TMay" -Surname "May" -UserPrincipalName [email protected] -Path "OU=Students, OU=User Resources,DC=School,DC=schoolname,DC=Org,DC=uk" -Office "2016" -EmailAddress [email protected] I don't use this much since getting Salamander, but it is still useful for non-personal accounts, e.g. Controlled Assessment or generic accounts for when the Year 6s come to visit for a week.
RichCowell Posted August 30, 2016 Posted August 30, 2016 If all else fails you could give this a try. Makes life easier with imports. - Account Management Spreadsheet I've used the same tool for years to create the new accounts, foolishly left it later than usual this year and the power's still off in my office so I've no access to the exe to run it - this worked a treat, and seems a lot more reliable!!
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