Now let's take a look at another situation when we want to perform Baalke use or enable disable operation.
There are two commands let's provided an Active Directory model to perform this operation when very
easy and straightforward.
This command lets are enabled Dash 80 account and disable this A-Day account.
The first one is used to enable Active Directory user computer or service account object.
And the second one obviously is used for disable an Active Directory user or a computer or service account
objects.
Both Luscum and let's require an object to be enabled to disable the object can be in one of the folder
and formats distinguished name or D.N. format.
For example CNN Equals Jorm comma or you equals slap DC equals control saw and DC equals Adey or com.
The format could be also object.
Do you ID security identifiers see it format or same account name format to get those values for a given
user.
Let's say for use or John they could use get their say to use or command left.
They could also use get a computer in case of computer accounts.
Now we have all only to pass the input values to either enable there's a media account or disable Desch
a day account.
Come on let's.
Based on which operation you want to perform.
So let's disable first Jones account account is disabled the call and does identity jum and pass through
parameter.
Again a reminder of that pass through parameter is used to return the object after the completion of
that operation.
Also it is useful to know the disable status if you want to perform further actions on this object.
You can also disable users in particular or you the foreign command will return all the user objects
on the lab.
All you need SOP's Allsopp all use while you can get a user command let surge based parameter Ambriel
below can an app O you will filter all the objects and this all over you that's what asterisks is Tan's
stand for and will pipe the results of this command to disable a account.
Come on let.
So all the users which are allocated with this get use or command will be disabled.
Again just a reminder for you that pipe service for the results of one command to another command to
limit the search scope to the current owner you could use this search scope parameter.
It takes three values basic or 0 1 Level 0 1 and 2 stop 3 or 2 subtree is the default value when you
specify nothing.
Let's move on and read usernames from a text file and disable them.
We'll be doing that with.
Get Come around come on loud and we'll be getting content from the file users.
Text me and pipe the results to the following code.
So here they get content.
Come on let's read the usernames from the text file and parses them one by one to the disable account.
Come on let use an foreach loop this percentage character means the same as for rich.
It is an alias for foreach loop in power shell.
So when parsing the user name to the disabled Adey account come and let me use the duller character
and underscore character automatic white variable which contains the name that is passed from the pipeline
to it.
You can disable all users in a department for example sales.
We could run the following command Queiroz all users who have their department values set to sales and
it passes them to their disable the account command led to disable them.
So the command looks like Let go get the user filter Department equals sales and Pypard the results
of this command to disable a D account command let likewise to perform an enabling operation.
Just replace disabler account Aidy account with it enable Aidy account command left.
In this example let's consider move an account to another.
For example let's consider Sonera where all users of one department are moved from one office building
to another.
So you would like to move all those user accounts to you or you for reasons of identification and management
of the move there's the object come on that is available in active directory module to accomplish this
operation.
This particular command left can move an object from one you to another not just user account has command
lad has two mandatory perimeters identity and target Poth identity perimeter identifies the object that
you want to move.
It can be either the distinguished name or the name of the object or do you I.D. of the object and other
men that were a perimeter is target Poth the target path perimeter must be the distinguished name of
the old you or the container to which you want to move the object.
Let's take a look at the fuller in command and move.
There's any object with identity.
John Root which is located in Aleppo U.
And we are moving it to the tech.
Oh you Richard SAPO you of a lab.
Oh you could also move all the users from a lab over you to production or you for example follow and
come and get the user will be filtering all their users in a lab over you and pipe the results to move.
There's 80 object command left and will be moved into production over you.
So once again this command will move all users including the users in SAPO use from lappe.
Oh you're too broad.
Oh you and the identity parameter is automatically populated from the output of the Gat.
There's a user come let you can use the following command to move users from one o you to another based
on their department name.
Let's say that we want to move all users who are in department sales to the sales department which is
in production.
We'll do that with get this as a user filter in my department which has equal sales and move all those
users move Desch the object to their sales production in production.
Also remember that Targett or you must exist before your move users to.