So far we've seen how to create a single user account and Active Directory.
Now let's explore how to create multiple user accounts in one go the following command is sufficient
enough if you want to create Baalke user objects in the lap environment result.
Vaurien about other properties such as Department email and so on.
So let's review this command and this command to create in 102 users.
Of course you can create more or less users like you can grade from 1 to 20 of from one to solve them
to users and for each user we are given a name like user and the number.
So the users will be created like Lerp user or one level user or two and so on the password for each
user will be equal to this variable which we've provided before and the users will be created in lap
over you.
So let's run this command and start to check it in Active Directory administrative center.
The command to complete it and we can go to Active Directory administrative settings service center
and check the newly created users in a lab.
Oh you as you can see it is populated now with the newly created users.
So it's a simple foreach loop that runs 100 times or whatever number of times you'll need to create
a user account with a name lab user and suffixed by the number of iterations sodgers.
As I've said lab user wanted lab user to and so on with their passwords cert to the value of the past
for 12 MBO.
However this is not sufficient to create accounts in production environment.
We need to populate several attributes at the time of creation ideally system administrators receive
their account creation information from H.R. department and some other department.
And ideally they receive it in CXXVI format and we can have a is file which will be read by Power Shell
and Treach you'll have the details of user attributes and create user accounts based on this information.
So to read this CSP file from a power shell variable we have a special command lead for it.
Come on let called import does this.
And it can read the contents of the file and return the output in object format.
We can make use of it to read the contents with the following command.
Let's create a variable which we'll call users and fields will be equal to import dustiest fee.
And we have to specify the pass to the saved CC file then will read this variable and output it in a
format table view so it will show the contents of the variable in table format just for testing purposes.
I have downloaded such a file in cells format from Microsoft Web site.
You can create such a file by yourself or also download it from Microsoft's Web site.
Now they have all user details in this fire file.
So that's Brucey to create user accounts from this file and we'll do that with the following command.
First real important to this file is the password but then we'll read this file with foreach command.
And for each user in this file we'll add the following properties.
Display Name given name Name Surname account name.
They count will be enabled and parsed for never expires.
For this account also will give you the principal name property account password Mildrid from the variable
which we've added before and the past to this account will be like let your past could be different.
So make sure you specify the correct path to the owner you in your environment.
In case you don't specify pass parameter it will put the account into the default.
You user.
So you anti-elite will perform that response through parameter which will show the results of the command.
Now let me open the file I've created from which will populate this parameterless as you can see we've
got all this information in this file.
And as you can imagine we can add and populate the information we need.
For example if we need to add e-mail we can do this by typing an e-mail here.
And we also have to type e-mail in each of the lines of this file.
For example for John Doe account we'll have Jadot at contorts dot com for Chris Greene account.
We'll have see green at contorts dot com.
We could also add a telephone number for this.
We add phone parameter on that our power line and we add the telephone for each account like this.
I left a telephone for John Doe 1 2 3 11 11 and to telephone for Chris Green 1 2 3 11 12.
And of course we have to address parameters in our script so we'll add the line here like e-mail address
which will be equal to variable user and e-mail.
We also have to add phone number this parameter office phone and it will be equal to the variable dollars
sign user that phone and it will populate the new users with the needed parameters.