Jump to content

Recommended Posts

Posted

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

Posted
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
Posted
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)
Posted

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.

  • 1 month later...
Posted
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!!

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...