1 00:00:06,420 --> 00:00:12,030 So far we've seen how to create a single user account an Active Directory. 2 00:00:12,030 --> 00:00:17,300 Now let's explore how to create multiple user accounts in one go. 3 00:00:17,430 --> 00:00:24,870 The following command is sufficient enough if you want to create bulk user objects in the lap environment 4 00:00:24,900 --> 00:00:31,230 without worrying about other properties such as Department email and so on. 5 00:00:31,410 --> 00:00:38,590 So let's review this command and this command we are creating 100 users. 6 00:00:38,640 --> 00:00:46,770 Of course you can create more or less users like you can create from 1 to 25 from 1 to solve them to 7 00:00:46,770 --> 00:00:56,310 users and for each user we are given a name lab user and the number so the user will be created like 8 00:00:56,580 --> 00:00:59,820 lap User 1 lap USER 2 and so on. 9 00:00:59,820 --> 00:01:07,770 The password for each user will be equal to this variable which we have provided before and the users 10 00:01:07,770 --> 00:01:11,230 will be created in lap over you. 11 00:01:11,310 --> 00:01:18,240 So let's run this command and off to the check it inactive directory administrative center. 12 00:01:18,360 --> 00:01:26,490 The command is completed and we can go to Active Directory Administrative Science Service Center and 13 00:01:26,490 --> 00:01:30,590 check the newly created users in the lab. 14 00:01:30,660 --> 00:01:40,380 Oh you as you can see it is populated now with the newly created users so it's as simple for reach loop 15 00:01:40,770 --> 00:01:49,190 that runs 100 times or whatever number of times you need to create a user account with a name lab user 16 00:01:49,520 --> 00:01:58,280 and SOF XT by the number of iterations such as as I've said lab user 1 a lab user 2 and so on with the 17 00:01:58,530 --> 00:02:02,570 password set to the value of the password available. 18 00:02:02,820 --> 00:02:08,070 However this is not sufficient to create accounts in production environment. 19 00:02:08,190 --> 00:02:13,400 We need to populate several attributes at the time of creation. 20 00:02:13,440 --> 00:02:21,450 Ideally system administrators receive their account creation information from H.R. department or in 21 00:02:21,450 --> 00:02:31,590 some other department and ideally they receive it in CSP format and we can have the CSP file which will 22 00:02:31,590 --> 00:02:40,650 be read by power shell and we shall have the details of user attributes and create user accounts based 23 00:02:40,650 --> 00:02:42,640 on this information. 24 00:02:42,690 --> 00:02:51,150 So to read that CSP file from a power shell variable we have a special command led for it a command 25 00:02:51,150 --> 00:03:01,290 led called import does Cicely and it can read the contents of the CAC file and return the output in 26 00:03:01,290 --> 00:03:02,790 object format. 27 00:03:02,850 --> 00:03:08,010 We can make use of it to read the contents with the following command. 28 00:03:08,010 --> 00:03:15,110 Let's create a variable which will call users and fields will be equal to import. 29 00:03:15,110 --> 00:03:21,520 This is free and we have to specify the pass to the saved as we file. 30 00:03:21,690 --> 00:03:32,100 Len will read this variable and output it in format table view so it'll show the contents of the variable 31 00:03:32,430 --> 00:03:35,940 in table format just for testing purposes. 32 00:03:35,950 --> 00:03:44,190 I've downloaded such a file and says for format from Microsoft Web site you can create such a file by 33 00:03:44,190 --> 00:03:51,330 yourself or also do download it from Microsoft's Web site. 34 00:03:51,340 --> 00:04:00,360 Now we have all user details in this file file so let's proceed to create user accounts from this file 35 00:04:00,660 --> 00:04:09,030 and we'll do that with the following command first will import this file of us the past variable then 36 00:04:09,030 --> 00:04:19,440 we'll read this file with for each command and for each user and this file will add the following properties 37 00:04:19,800 --> 00:04:22,020 display name given name. 38 00:04:22,020 --> 00:04:25,020 Name surname same account name. 39 00:04:25,170 --> 00:04:30,060 The account will be enabled and password never expires. 40 00:04:30,060 --> 00:04:37,300 For this account also will give user principal name proper to account password. 41 00:04:37,420 --> 00:04:44,700 Will you read it from the variable which we've added before and the past to this account will be like 42 00:04:44,700 --> 00:04:45,380 that. 43 00:04:45,450 --> 00:04:54,720 Your past could be different so make sure you specify the correct path to the you in your environment 44 00:04:55,020 --> 00:05:02,830 in case you don't specify pass parameter it'll put the account into the default or you. 45 00:05:02,880 --> 00:05:10,760 Which is user so you and will perform a twist pass through parameter which will show the results of 46 00:05:10,760 --> 00:05:11,870 the command. 47 00:05:11,870 --> 00:05:19,360 Now let me open the file I've created from which will populate these parameters. 48 00:05:19,430 --> 00:05:28,250 As you can see we've got all this information in this file and as you can imagine we can add and populate 49 00:05:28,280 --> 00:05:30,620 the information we need. 50 00:05:30,620 --> 00:05:38,090 For example if we need to add e-mail we can do this by type in e-mail here. 51 00:05:38,420 --> 00:05:48,850 And we also have to type e-mail in each of the lines of this file for example for John Doe account will 52 00:05:48,920 --> 00:06:02,920 have Jane Doe at come to us dot com for Chris Green account will have C green at com torso dot com. 53 00:06:03,050 --> 00:06:13,430 We could also add telephone number for this we add phone parameter on the upper line and we add the 54 00:06:13,430 --> 00:06:17,620 telephone for each account like this. 55 00:06:17,680 --> 00:06:27,380 I'll let a telephone for John Doe 1 2 3 eleven eleven and to telephone for Chris Green on two three 56 00:06:27,740 --> 00:06:28,940 eleven twelve. 57 00:06:29,270 --> 00:06:39,920 And of course we have to add these parameters in our script so we'll add the line here like email address 58 00:06:40,250 --> 00:06:46,510 which will be equal to variable user and email. 59 00:06:46,520 --> 00:06:58,040 We also have to add phone number as parameter office phone and it will be equal to the variable dollars 60 00:06:58,310 --> 00:07:07,700 sign user dot phone and it will populate the new users with the needed parameters.