In this lesson we'll talk about modifying the user properties and the previous lesson.
We've seen how to create user accounts use an Active Directory power show module and Active Directory
administrative center.
The task of system administrator will not and just by creating user objects in Active Directory they
will also be responsible for modifying and managing them.
This lesson will help you to understand the process involved in modifying the user accounts using power
shell.
Since modifying user accounts has a very big scope we'll discuss a few examples.
Example cases where a bulk user modification is required.
These examples will help you to understand the modification process.
You can leverage these examples to modify any other attributes in Active Directory like updating the
description of a user object updating the telephone number of multiple users enabling or disable user
accounts in bulk moving user accounts to another you before starting to modify user properties.
Let's brush up on the basics with graphical user interface to update the description of a user account.
You'll typically follow the steps open Active Directory administrative center to search for for a user
name in Active Directory.
Go to the properties of the object and update the description and save your changes by clicking on a
kid.
What happens under the scenes when you update the description of the object and save it.
The system rewrites the value to the respective attribute of that user object.
You can view all attributes and their values using the attribute editor tab in Active Directory administrative
center or Active Directory Users and Computers.
Of course you can also use Ada as I added that MSE tool for those purposes.
So let's find some user with a name Tom and to view his attributes details in attribute editor.
So in order to update in India tales of a user object.
First we need to know its attribute name or display name and also all this.
Remember that the names for properties you see and graphical user interface tools might not be the same
as what you're seeing the attribute editor.
For example the first name field you see in graphical user interface is translated to a given name in
the attribute editor.
Similar to the goofy approach we can search for a user object and list its attributes using power shell
with get Dash 80 user command led and we can add filter.
For example we can type get a user filter parameter and we'll filter it by name which is equal to Tom.
This will return the user object with the name attribute having the value of Tom by default it will
return only a basic set of attributes.
If you want to see all the attributes of this user object then specify the property parameter so let's
add to this command property parameter and we'll be looking for all the properties of this user.
The wildcard for all the properties as you might remember is asterisk.
You can also query users matching their name.
In that case you can add asterisk to the filter you've used before like Tom and asterisks will find
all the users which are starting with Tom.
Similarly you can query all objects inside a particular organizational unit by passing the or you distinguished
name to their search based parameter.
So we could type get user filter parameter asterisks search based parameter and we'll be looking in
lab.
Oh you you might have another oh you so you have to change this address which are suitable to your environment.
Now when we know how to search for objects let's move on to learn how to modify them updating the description
of a user object is not that hard.
Let's use that for Tom object which we have found before.
So we could create a variable which will be called Dollar character user OBJ which is for user object
and it will be equal to get thus a user with filter by name which is equal to Tom and properties will
be looking for for all properties of that user object.
We can also now view the current description of the user object by using the following command the variable
user OBJ dot description assuming that the user account has a description set to replace the current
description with a new value.
First we need to understand what data type this attribute will accept.
As you might remember we can find this out.
You then get type method.
You can invoke this method as shown in the following command variable User object the description that
get type in brackets the output of this command shows that it accepts data types driven so to update
the description to a new value.
We need to use the set.
Is a user command led and passed the user object wearable to the identity parameter and the string that
you want to set in the description field to the description parameter.
We have this command and this command will return to the power shall prompt him.
Power shall render if it completes without any errors so the command looks like that set a user with
identity parameter which is user object variable description parameter which is the new description
will be modify and so in quotes we have to add a new description and to verify if the new description
is updated and the user description field we can either check it through the graphical user interface
or wrong the power shall command that we used for querying the user object in the preceding commands.
So putting everything together the following code will update the description of a given active directory
user first will set the variable user name then will set and other wearable new description which will
be equal to some string.
We also at user object wearable which will be equal to get the user with filter and properties.
We could also use right host to get the car and description of the user object and after that we set
new description with set the user identity will be equal to the variable User object and a description
parameter which will be equal to new description variable which we have added before and now we could
get the user and check the new description.
So we do that with a new variable User object or in my case it's the same variable which I've used before
which is equal to get the user fill turn by name.
User name and its properties and we could output it to the screen and see the new description of the
object in such a way you can update valence of any other attribute in the procedure shown in this code.
So you could try updating for example the display name of a user for your practice.