And in one group as a member to another in previous lessons we saw how to add to user accounts on computer
accounts to secure two groups by using the Active Directory.
Come on let's another common Active Directory operation related to security groups is add in one security
group to another security group.
This is done for reasons of management of permissions and memberships before proceeding to see how groups
can be nested.
Let's first understand what type of scope of groups can be added to a given security group.
Without this you might run into areas such as in this example and start thinking what is wrong.
So let's run this command and try to add one group to another.
We have gotten narrow and if you read the error message carefully it clearly states that a local group
cannot be a member of universal group.
It is good to know these things before attempting to hurt a group in another group.
You can read more about the different security group types and their membership details but in short
a universal group can hold global and universal groups from any other man in the same forest as members
a global group can hold other global groups from the same forest and to the main local group can hold
global groups from any domain including trusted universal groups from the same forest.
Domain groups from the same domain and global and universal groups from other forests.
Now let's add just groups free to test group.
Now we have we haven't got to narrow and does group 3 can be freely nested into test group lists command
outs a group named Task Group 3 to test group.
If you notice they are not providing any group scope information at the time of adding the command letter
will automatically calculate the group sound.
If the addition is not supported it will throw arrows.
Otherwise the execution should get completed without any errors.
We can check in with the users and computers.
Council will find a test group and check its members and we can find test group 3 here and see that
it was successful they added.
What about bulk group's creation as we saw in the example of Adam bulk users.
That computer as a counter group.
Security groups can be added in bulk as well.
For this demonstration we can use the following code.
We can create for example for security groups and active directors so that you can add them to a new
security group in bulk.
Create in bulk use groups is very easy.
If they share a similar naming convention as shown in this code.
So we are creating the groups from 1 to 4 and for each group will give a name.
CHILD group and a number from 1 to 4 and will add to this group to active directory with its name.
The scope will be domain local and the path where these groups will be located is groups in production
or you.
So running this code will create 4 groups with the name child Group 1 2 4 and it will do this operation
in seconds.
Now we can add these newly created groups to a secure to another security group with their members.
First let's create a group to which we want to add this newly created 4 groups.
As we saw before a group can be created by using the new dash age group command let the following command
will create the parent group one security group.
So let's run it.
We are new does a group the name parent group 1 and the scope for it will be domain local.
Once the group is created we can add to the newly created for child groups to this parent group one
using the following command will add a variable which will be called groups and equal together as a
group filter in all of the groups which contain child group in its name.
And then we pass this trouble to the following command at this age group member.
They are read in groups to two this group which is called Parent Group one and the groups which we all
read and is taken from groups variable which we have created before.
So the first line of the code will soar shift active director for any group that has a name starting
with child group and strokes the details in the group's variable.
Once the details are available they can be added to another security group.
Parent Group 1 using the out.
Is a group member command led and the groups will be added.