This lesson or will practice with manage and use around computer objects we'll be focusing on accomplishing
the following tasks.
You then Power Shell will be creating new user and computer accounts modifying user and computer objects
enabling and disabling the user and computer accounts more than the user and computer account deleting
the user and computer records.
As you may know Active Directory is all about users and computers.
Each user in the organization will have at least one account.
There will be scenarios where a single user can have multiple accounts.
This is very true in the case of I.T. users where one account is used for regular activities such as
checking email browsing and so on whereas there are the privilege to account is used for managing the
infrastructure.
Apart from these there are service accounts that are designed to run a particular service.
This shows how rapidly user accounts can grow in Active Directory environment along with the necessity
to manage them in a much more efficient way.
In the fall of last and we'll be explaining how to perform user object operations use power sharing.
So let's begin with creating user accounts managing user accounts is one of the day to day job.
So as the Windows administrator new user John company is on a frequent basis and sometimes the Walder
might go by in such cases creating user accounts to use using conventional methods is a time consuming
and involves errors.
So the best choice in that case is automation.
It produces less errors and it's less time consuming.
In Active Directory the manual account creation process involves graphical user interface or guru such
as Active Directory Users and Computers and Active Directory administrative center.
First let's take a look at how user creation can be done to use an Active Directory administrative center.
It relies on Active Directory power shell command lets and to use them in the background to perform
the Active Directory liberations.
We can start it by clicking on server manager and one server manager is launched.
We go to the upper right corner.
Click on Tools menu and Blaunche Active Directory administrative center and the left side pane we have
to select our domain.
In my case it's contorts So when we select the domain the new tasks pain will show up in the right part
of this window.
Here you can find this new bottom will click on it and select new user.
There are two mandatory fields that must be provided in order to create a user account.
Full name and user same account name.
Other fields are optional at the time of user creation and can be updated later.
You might have also noticed that the password is not specified at the time of creation so active directory
keeps this field in a disabled state until the passport is set.
Once the passport is set by the administrator the user object has to be enabled explicitly.
Similarly when a user account is created Husan power shell.
It has to be one mandatory property that must be parsed.
The name parameter this parameter is equal to the full name.
Well in UI.
Also the same parameter well is used for the user of same account name attribute that at the same time
of user account creation use and power shell and user account in the Active Directory can be created
to you and the new Desch the user command left.
So let's launch Power Shell integrated scripting environment or IAC and try the following command.
A new dash 80 user name parameter and will specify user's name.
I'll type test user one for the test and purposes.
Rather this amount is executive from the power shell vendor.
It creates are as the default user container they count created it will be in a disabled state because
no password has been provided at the time of creation.
This behavior is different when you create users use an active directory users and computers can.
So we're providing a password is mandatory as you can guess these commands that we have run.
It's not sufficient for creating user accounts in the production environment you are required to provide
well use for different attributes such as first name last name display name password two options such
as user must change password to the next time around Office address phone numbers job title department
and so on.
So we need to enhance our code to populate these properties.
At the time of look them before we start creating a full fledged user account.
Let's see which properties can be populated by the new Desch 80 user command lad at the time of user
creation.
You can get this simply by Iran in the following help command get help.
Mutilator user detailed the get help command.
You could also type just help.
So this command led to the power shell command led to use and see the help content of any of the command
land.
The usage of detailed Savvich tells.
Get help.
Come on let's run.
All the help contend for the given and left.
It includes a list of parameters their syntax and explanation of parameters and examples.
Which is very useful when you run this command.
You can find that there are various properties called attributes.
You can set these attributes at the time of user creation.
If the attribute you want to set is not present then you can use the other attributes parameter to set
it.
Note that you need to provide other attributes names and well use in a hash table format while passing
to their other attributes parameters.
Will take a closer look at this hash tables later on when we'll be talking about modifying user properties.
Now let's see how we can create any user account by Pozen all kinds of ralliers that we want to set
at that same time of user creation.
In this example we'll cover some of the properties that are frequently used to the time of use or object
creation.
However you can modify this command and play around with certain other parameters and remember that
practice makes one perfect.
The pass through parameter is used to return the user object after creation of the account.
If this parameter is not specified the command led will not show you any output after successful creation
of the object.
So first we need to prepare a POS for it for the user to do the setting since their account Ponsford
come and let requires their input to be in securest reinforcement.
We need to populate the POS for terrible with the desired Botsford as shown in this command.
So in this command we create a wearable which is equal to read most Come and let is as secure trend
parameter.
It means that everything that we type will be parsed as securest dream to this wearable and this will
prompt you to enter the password and you'll see asterisk symbols as you.
And to ensure that the password to your entered should miss the password complexity of your domain.
Otherwise the following command will fail.
Now let's create a new user with a full own command.
We'll do that with the new 80 user command let his name parameter given name email address same account
name account password that will be used in the variable which we have created before.
Display name department can receive the best parameter which will ensure that the account will be created.
That needed you and enabled parameter which means that the account will be enabled enabled after creation
pass through parameter.
I've emancipate it or show us the result of this command again about pass parameters ensure that you
update path parameter to reflect their distinguished name over there.
Or you in your environment.
Otherwise the operation might fail.
And also please know that pass parameter is optional.
If you don't specify this the user account will be created in the default to users contain and run Mirabilis
command the power shell will return the output as follows.
The output shows the path of the object where it is created and other properties is set during the creation
process.
By default there output shows only a minimum set of attributes.
You can see all current attributes and the values of user object using the Get A user command let's
so let's run it.
Get a user with identity parameter and we have to specify the user we are looking for.
And after that Propertius parameter and asterisk which will find all the properties for the user we
are looking for.
And we can see the output of this command.