1 00:00:06,460 --> 00:00:14,580 Now let's take a look at another situation when we want to perform bulk user enable disable operation. 2 00:00:14,590 --> 00:00:15,250 There are two. 3 00:00:15,250 --> 00:00:25,070 Come on let's provided an active drug to remodel to perform this operation when very easy and straightforward. 4 00:00:25,140 --> 00:00:31,540 This command lets SA enabled dash ADR account and disable this 80 account. 5 00:00:31,690 --> 00:00:39,760 The first one is used to enable Active Directory user computer or service account objects. 6 00:00:39,760 --> 00:00:47,530 And the second one obviously is used for disabled and Active Directory user computer or service account 7 00:00:47,530 --> 00:00:48,490 objects. 8 00:00:48,490 --> 00:00:49,630 Both lists. 9 00:00:49,630 --> 00:00:57,550 Come on let's require now object to be enabled to disable the object can be in one of the following 10 00:00:57,550 --> 00:00:58,520 formats. 11 00:00:58,600 --> 00:01:11,470 Distinguished name or d n format for example CNN Equals John comma or U equals slab D C equals com Tulsa 12 00:01:11,760 --> 00:01:15,740 and the C equals A.D. or com. 13 00:01:15,810 --> 00:01:25,420 The format could be also object do you I.T. Security identify our seed format or same account name format 14 00:01:25,660 --> 00:01:34,390 together this values for a given user let's say for user John we could use get the say the user command 15 00:01:34,390 --> 00:01:41,540 let we could also use get this a computer in case of computer accounts. 16 00:01:41,650 --> 00:01:52,880 Now we have all only to pass the input values to either the enable does ADR count or disable dash Ada 17 00:01:52,880 --> 00:01:53,840 account. 18 00:01:53,860 --> 00:01:54,900 Come on let's. 19 00:01:54,970 --> 00:01:57,760 Based on which operation you want to perform. 20 00:01:58,060 --> 00:02:07,460 So let's disable first John's account was disabled the shady account there's identity John and pass 21 00:02:07,460 --> 00:02:08,820 through parameter. 22 00:02:08,920 --> 00:02:16,240 Again a reminder that path through parameter is used to return the object after the completion of the 23 00:02:16,360 --> 00:02:17,440 operation. 24 00:02:17,440 --> 00:02:25,880 Also it is useful to know the disabled status if you want to perform further actions on this object. 25 00:02:25,900 --> 00:02:29,890 You can also disable users in a particular or you. 26 00:02:30,010 --> 00:02:39,390 The following commands will return all user objects on the lap over you and it stops or stop or use. 27 00:02:39,420 --> 00:02:47,610 Where are you then get a user command led surge based parameter and will be looking in lab. 28 00:02:47,650 --> 00:02:52,770 Oh you will filter all the objects in this all over you. 29 00:02:52,780 --> 00:03:01,480 That's what asterisks is stands stand standard for and will pipe the results of this command to disable 30 00:03:01,570 --> 00:03:08,770 a discount command land so all the users which are allocated whizzes get a D user. 31 00:03:08,770 --> 00:03:11,720 Command will be disabled again. 32 00:03:11,740 --> 00:03:19,570 Just a reminder for you that pipe serves for moving the results of one command to another command to 33 00:03:19,570 --> 00:03:22,640 limit the search scope to the current Oyu. 34 00:03:22,770 --> 00:03:26,300 We could use this search scope parameter. 35 00:03:26,410 --> 00:03:36,550 It takes three values basic or 0 1 level or 1 and a sub three or two sub three is a default value. 36 00:03:36,820 --> 00:03:45,040 When you specify Northam let's move on and read user names from a text file and disable them. 37 00:03:45,070 --> 00:03:54,240 We'll be doing that with get content command led and will be getting content from the file users the 38 00:03:54,360 --> 00:03:59,490 60 and pipe the results to the following code. 39 00:03:59,530 --> 00:04:00,370 So here they are. 40 00:04:00,370 --> 00:04:01,710 Get content. 41 00:04:01,720 --> 00:04:09,100 Come on let rates the user names from the text file and passes them one by one to the disable account. 42 00:04:09,100 --> 00:04:12,090 Come on let using for each loop. 43 00:04:12,100 --> 00:04:17,270 This percentage character means the same as for rich. 44 00:04:17,350 --> 00:04:21,350 It is an alias for a for each loop in power shell. 45 00:04:21,610 --> 00:04:26,440 So when passing the user name to the disabled ADR account. 46 00:04:26,440 --> 00:04:36,400 Come on let me use the dollar character and underscore character automatic Y variable which contains 47 00:04:36,490 --> 00:04:40,730 the name that is passed from the pipeline to it. 48 00:04:40,750 --> 00:04:45,890 You can disable all users in a department for example sales. 49 00:04:45,960 --> 00:04:53,730 We could run the following command queries all users who have their department values set to sales and 50 00:04:53,730 --> 00:04:56,800 it passes them to the disable. 51 00:04:57,010 --> 00:05:05,110 ADR account command led to disable them so the command looks like that go to the user filter department. 52 00:05:05,250 --> 00:05:13,860 Equals sales and pipe at the results of this command to disable the account command land likewise to 53 00:05:13,860 --> 00:05:16,170 perform an enable operation. 54 00:05:16,170 --> 00:05:23,920 Just replace disable account A.D. account with will enable A.D. account command led. 55 00:05:24,060 --> 00:05:28,770 In this example let's consider moving accounts to another you. 56 00:05:28,770 --> 00:05:36,660 For example let's consider a scenario where all users of one department are moved from one office building 57 00:05:36,690 --> 00:05:37,680 to another. 58 00:05:37,680 --> 00:05:44,700 So you would like to move all this user accounts to an you or you for reasons of identification and 59 00:05:44,700 --> 00:05:45,790 management. 60 00:05:45,840 --> 00:05:54,750 The move does ADR object common letters available in Active Directory module to accomplish this operation. 61 00:05:54,750 --> 00:06:03,470 This particular command led can move an object from one or you to another not just user accounts as 62 00:06:03,480 --> 00:06:13,260 command led has 2m mandatory parameters identity and target path identity parameter identifies the object 63 00:06:13,650 --> 00:06:22,360 that you want to move it can be either the distinguished name or the end of the object or the do you 64 00:06:22,350 --> 00:06:27,370 idea of the object and other mandatory parameter is target. 65 00:06:27,370 --> 00:06:35,340 Pass the target pass parameter must be the distinguished name of the OR YOU OR THE contain it to which 66 00:06:35,340 --> 00:06:37,620 you want to move the object. 67 00:06:37,620 --> 00:06:46,110 Let's take a look at the following command values and move this 80 object with identity join with which 68 00:06:46,110 --> 00:06:56,950 is located in Aleppo you and we are moving it to the tech 0 you Richard stop or you of lap or you. 69 00:06:57,010 --> 00:07:05,370 You could also move all the user from lab all you to production or you for example with the following 70 00:07:05,370 --> 00:07:15,870 command get the user will be filtering all the users in lab or you and pipe the results to move dash 71 00:07:15,920 --> 00:07:22,060 a the object command led and will be moving to production or you. 72 00:07:22,080 --> 00:07:30,190 So once again this command will move all users including users in SOP or use from the lab. 73 00:07:30,250 --> 00:07:32,380 Oh you're too broad are you. 74 00:07:32,520 --> 00:07:39,950 And the identity parameter is automatically populated from the output of the guard. 75 00:07:39,980 --> 00:07:42,150 There's a user command led. 76 00:07:42,360 --> 00:07:49,680 You can use the following command to move users from one or you to another based on their department 77 00:07:49,680 --> 00:07:50,310 name. 78 00:07:50,490 --> 00:08:01,290 Let's say that we want to move all users who are in dept sales to the sales department which is in production. 79 00:08:01,290 --> 00:08:10,020 We'll do that with get this a user filter and by department which has equal sales and move all this 80 00:08:10,020 --> 00:08:18,660 users with move Dash 80 object to the OR use sales production in production. 81 00:08:18,660 --> 00:08:23,950 Also remember that target or you must exist before you move users to.