WEBVTT

00:00.450 --> 00:08.610
Now let's take a look at another situation when we want to perform Baalke use or enable disable operation.

00:08.610 --> 00:16.650
There are two commands let's provided an Active Directory model to perform this operation when very

00:16.780 --> 00:18.980
easy and straightforward.

00:19.140 --> 00:25.710
This command lets are enabled Dash 80 account and disable this A-Day account.

00:25.710 --> 00:33.690
The first one is used to enable Active Directory user computer or service account object.

00:33.750 --> 00:41.550
And the second one obviously is used for disable an Active Directory user or a computer or service account

00:41.550 --> 00:42.300
objects.

00:42.510 --> 00:51.350
Both Luscum and let's require an object to be enabled to disable the object can be in one of the folder

00:51.380 --> 00:55.700
and formats distinguished name or D.N. format.

00:55.830 --> 01:09.780
For example CNN Equals Jorm comma or you equals slap DC equals control saw and DC equals Adey or com.

01:09.840 --> 01:12.390
The format could be also object.

01:12.540 --> 01:21.660
Do you ID security identifiers see it format or same account name format to get those values for a given

01:21.660 --> 01:22.430
user.

01:22.590 --> 01:29.120
Let's say for use or John they could use get their say to use or command left.

01:29.220 --> 01:35.650
They could also use get a computer in case of computer accounts.

01:35.770 --> 01:46.470
Now we have all only to pass the input values to either enable there's a media account or disable Desch

01:46.520 --> 01:47.880
a day account.

01:47.880 --> 01:48.940
Come on let's.

01:48.990 --> 01:51.940
Based on which operation you want to perform.

01:52.080 --> 02:01.790
So let's disable first Jones account account is disabled the call and does identity jum and pass through

02:01.790 --> 02:02.910
parameter.

02:02.940 --> 02:10.110
Again a reminder of that pass through parameter is used to return the object after the completion of

02:10.110 --> 02:11.420
that operation.

02:11.430 --> 02:19.730
Also it is useful to know the disable status if you want to perform further actions on this object.

02:19.890 --> 02:28.130
You can also disable users in particular or you the foreign command will return all the user objects

02:28.190 --> 02:29.320
on the lab.

02:29.340 --> 02:39.450
All you need SOP's Allsopp all use while you can get a user command let surge based parameter Ambriel

02:39.450 --> 02:49.020
below can an app O you will filter all the objects and this all over you that's what asterisks is Tan's

02:49.230 --> 02:56.780
stand for and will pipe the results of this command to disable a account.

02:56.790 --> 02:57.770
Come on let.

02:57.930 --> 03:05.360
So all the users which are allocated with this get use or command will be disabled.

03:05.400 --> 03:13.590
Again just a reminder for you that pipe service for the results of one command to another command to

03:13.590 --> 03:20.360
limit the search scope to the current owner you could use this search scope parameter.

03:20.400 --> 03:31.380
It takes three values basic or 0 1 Level 0 1 and 2 stop 3 or 2 subtree is the default value when you

03:31.680 --> 03:33.180
specify nothing.

03:33.330 --> 03:39.040
Let's move on and read usernames from a text file and disable them.

03:39.070 --> 03:40.580
We'll be doing that with.

03:40.630 --> 03:48.190
Get Come around come on loud and we'll be getting content from the file users.

03:48.280 --> 03:53.370
Text me and pipe the results to the following code.

03:53.520 --> 03:55.590
So here they get content.

03:55.740 --> 04:03.120
Come on let's read the usernames from the text file and parses them one by one to the disable account.

04:03.120 --> 04:11.300
Come on let use an foreach loop this percentage character means the same as for rich.

04:11.340 --> 04:15.450
It is an alias for foreach loop in power shell.

04:15.600 --> 04:24.630
So when parsing the user name to the disabled Adey account come and let me use the duller character

04:24.660 --> 04:33.510
and underscore character automatic white variable which contains the name that is passed from the pipeline

04:33.930 --> 04:34.680
to it.

04:34.740 --> 04:39.870
You can disable all users in a department for example sales.

04:39.960 --> 04:47.740
We could run the following command Queiroz all users who have their department values set to sales and

04:47.740 --> 04:53.760
it passes them to their disable the account command led to disable them.

04:53.820 --> 05:02.880
So the command looks like Let go get the user filter Department equals sales and Pypard the results

05:02.880 --> 05:10.160
of this command to disable a D account command let likewise to perform an enabling operation.

05:10.170 --> 05:18.000
Just replace disabler account Aidy account with it enable Aidy account command left.

05:18.060 --> 05:22.740
In this example let's consider move an account to another.

05:22.770 --> 05:30.690
For example let's consider Sonera where all users of one department are moved from one office building

05:30.720 --> 05:31.550
to another.

05:31.680 --> 05:39.510
So you would like to move all those user accounts to you or you for reasons of identification and management

05:39.650 --> 05:47.640
of the move there's the object come on that is available in active directory module to accomplish this

05:47.640 --> 05:48.750
operation.

05:48.750 --> 05:57.840
This particular command left can move an object from one you to another not just user account has command

05:57.870 --> 06:07.890
lad has two mandatory perimeters identity and target Poth identity perimeter identifies the object that

06:07.890 --> 06:08.970
you want to move.

06:09.120 --> 06:18.770
It can be either the distinguished name or the name of the object or do you I.D. of the object and other

06:18.780 --> 06:26.250
men that were a perimeter is target Poth the target path perimeter must be the distinguished name of

06:26.250 --> 06:31.490
the old you or the container to which you want to move the object.

06:31.650 --> 06:35.580
Let's take a look at the fuller in command and move.

06:35.590 --> 06:38.730
There's any object with identity.

06:38.880 --> 06:43.300
John Root which is located in Aleppo U.

06:43.530 --> 06:46.960
And we are moving it to the tech.

06:46.980 --> 06:50.360
Oh you Richard SAPO you of a lab.

06:50.390 --> 06:59.170
Oh you could also move all the users from a lab over you to production or you for example follow and

06:59.210 --> 07:09.630
come and get the user will be filtering all their users in a lab over you and pipe the results to move.

07:09.620 --> 07:15.990
There's 80 object command left and will be moved into production over you.

07:16.110 --> 07:24.190
So once again this command will move all users including the users in SAPO use from lappe.

07:24.230 --> 07:25.660
Oh you're too broad.

07:25.710 --> 07:33.980
Oh you and the identity parameter is automatically populated from the output of the Gat.

07:33.990 --> 07:42.330
There's a user come let you can use the following command to move users from one o you to another based

07:42.330 --> 07:44.490
on their department name.

07:44.490 --> 07:53.970
Let's say that we want to move all users who are in department sales to the sales department which is

07:53.970 --> 07:55.220
in production.

07:55.290 --> 08:03.990
We'll do that with get this as a user filter in my department which has equal sales and move all those

08:04.020 --> 08:12.660
users move Desch the object to their sales production in production.

08:12.660 --> 08:17.900
Also remember that Targett or you must exist before your move users to.
