4.5: Creating and Managing Groups
Overview of Groups
In Windows 2000, groups allow collections of objects in the Active Directory to be referred to as a single object. Essentially, they are "one-to-many" pointers that can be used to refer to a collection of objects as a single entity. Although groups are actually references and not containers, it is common to say a group "contains" objects.
Groups are a primary tool used by system administrators to reduce the burden of managing large numbers of users. This section details the various types of groups available in Windows 2000 and focuses on the many ways administrators can manage groups themselvesboth manually and programmaticallyto further reduce administrative burden.
Local (SAM) Groups
Like local (SAM) accounts, Local groups are maintained by computers that are not Domain Controllers. These computers support a Security Accounts Manager (SAM) service that maintains Local groups. Local groups are known only to the local computer (they are not published in the Active Directory) and can only be assigned permissions to local resources.
For more information on the SAM service, see Chapter 4.4, "Creating and Managing User Accounts."
In the absence of a domain architecture, Local groups still give an administrator the ability to simplify the assignment of rights. Local groups can contain local users, thereby allowing the administrator to apply user rights to a broad number of users at once.
But the real power of the Local group is realized when the computer becomes a member of a Domain. Local groups become much more powerful in a Domain configuration because only then may they contain Global groups from the Domain or trusted Domains. You will learn more about Global groups in a moment, but right now all you need to know is that some of these Global groups may originate from (and thus can be administered in) other domains. By allowing "nested group" memberships such as these, the administrator of the local computer can delegate some administrative functions to administrators in other domains. He can assign resource permissions to groups under the control of another (trusted) Domain administrator, giving that administrator the ability to control who has access to specific resources, but not the ability to change the specific permissions assigned to the resource.
This methodology is the preferred way to assign permissions to large groups of users in a trusted multi-domain environment: Users are added to Global groups, Global groups are added to Local groups, and Local groups are assigned permissions to resources.
Domain Groups
When a domain architecture is implemented, a number of additional group types become available. Each of these groups has specific characteristics and uses that make them useful in certain scenarios.
Security Groups and Distribution Groups
Although there are many different kinds of groups available in a Domain, they all fall into two broad categories:
Security groups. Security groups use the power of object grouping to simplify the security process for administrators. In general, when a Security group is assigned permissions to a resource, all the members of the group receive those permissions.
Distribution groups. In electronic mail systems, distribution lists allow users to send messages to groups of users. Microsoft's Active Directory strategy has a big place set at the table for electronic mail. In the near future, what were known as distribution lists will be represented as Distribution groups. Distribution groups may not be used to control security.
Within each of these two categories, a number of specialized groups can exist: Universal groups, Global groups, and Domain Local groups. Let's take a brief look at each one of these.
Universal Groups
Universal groups are a powerful new kind of group, available only on domains that operate in Native mode. Universal groups allow an administrator to group together objects from anywhere within the forest. If created as a Security group, administrators in any domain in the forest may assign the group permissions. Powerful Universal groups should be used carefully because their membership is replicated throughout the forest in the Global Catalog (GC). It is important to note that the GC contains a full membership list of the Universal group. Any changes to Universal group membership, therefore, will initiate a forest-wide change that must be replicated. For this reason, it is recommended that changes to Universal group membership be limited. One strategy to accomplish this is to have only Global groups contained within the Universal group. In this manner, individual user membership changes happen at the Global group level, but do not alter the explicit membership of the Universal group and therefore do not initiate a forest-wide replication of the group.
Universal groups can contain Domain user accounts, Global groups and other Universal groups.
Global Groups
Windows 2000 Global groups have many similar characteristics to Global groups in Windows NT 4.0. One new characteristic in Windows 2000 is that Global groups are published in the Global Catalog (GC) so that other domains in the forest can become aware of the group. However, the membership details of Global groups are not contained in the GC, so it is acceptable to make frequent changes to Global group membership because this will not impact GC replication.
Global groups may contain Domain user accounts and, if the Windows 2000 Domain is operating in Native mode, other Global groups are in the domain in which they were created.
Domain Local Groups
Domain Local groups can be created and used only on Domain Controller computers. They are analogous to Local groups on Windows 2000 Professional Workstations: They are known only to computers holding the account database (Domain Controllers), and can therefore be applied only to resources on those computers.
Domain Local groups can contain practically all other security objects: Domain User accounts, Domain Local groups (from the same domain), Domain Global groups, and Universal groups.
Nesting Groups
The group types most used in mature Windows 2000 Domain environments are Universal and Global groups. These groups differ primarily in their scope of membership: Universal groups can contain objects from any Domain, whereas Global groups can contain users from the local Domain only. It is often useful to nest groups within each other to leverage these differences in group scope to provide good cross-domain security models.
Table 4.5.1 shows the nesting relationships between the various group types in Windows 2000.
Table 4.5.1 Types of Groups in Windows 2000
THESE GROUPS |
|||||||
Local Groups |
Domain Groups |
||||||
Security |
Distribution |
||||||
|
|
Global |
Local |
Universal* |
Global |
Local |
Universal* |
May Contain |
|
|
|
|
|
|
|
Local accounts |
YES |
NO |
NO |
NO |
NO |
NO |
NO |
Domain accounts |
YES*** |
YES**** |
YES |
YES |
YES**** |
YES |
YES |
May Contain |
|
|
|
|
|
|
|
Local group |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
Domain Security Global |
YES |
YES* |
YES |
YES |
YES* |
YES |
YES |
Domain Security Local |
NO |
NO |
YES** |
NO |
NO |
YES** |
NO |
Domain Security Universal |
YES |
NO |
YES |
YES |
NO |
YES |
YES |
Domain Distribution Global |
NO |
YES* |
YES |
YES |
YES* |
YES |
YES |
Domain Distribution Local |
NO |
NO |
YES** |
NO |
NO |
YES** |
NO |
Domain Distribution Universal |
NO |
NO |
YES |
YES |
NO |
YES |
YES |
Can be Referenced in ACLs |
|
|
|
|
|
|
|
On local computer |
YES |
YES |
YES |
YES |
NO |
NO |
NO |
Any Domain Controller in Domain |
NO |
YES |
YES |
YES |
NO |
NO |
NO |
Any domain member |
NO |
YES |
NO |
YES |
NO |
NO |
NO |
Throughout the forest |
NO |
YES |
NO |
YES |
NO |
NO |
NO |
Appear in global catalog |
NO |
YES |
NO |
YES |
YES |
NO |
YES |
Membership contained in global catalog |
NO |
NO |
NO |
YES |
NO |
NO |
YES |
Default Domain Groups
When Active Directory is installed on a computer, the directory is automatically populated with a set of default groups to help you administer the Domain (see Table 4.5.2). These groups are created in the Builtin container, and always exist in every Domain.
Table 4.5.2 Contents of the Builtin Container After Installing AD
Name |
Description |
Account Operators |
Members can administer Domain user and Group accounts. |
Administrators |
Administrators have full access to the computer/Domain. |
Backup Operators |
Backup Operators can only use a backup program to back up files and folders on to the computer. |
Guests |
Guests can operate the computer and save documents, but cannot install programs or make potentially damaging changes to the system files and settings. |
Print Operators |
Members can administer Domain printers. |
Replicator |
Supports file replication in a Domain. |
Server Operators |
Members can administer Domain servers. |
Users |
Users can operate the computer and save documents, but cannot install programs or make potentially damaging changes to the system files and settings. |
Creating, Deleting, and Modifying Group Accounts
Some of the most basic tasks you'll be doing as a Windows 2000 administrator include creating and deleting group accounts. There are several ways to accomplish those tasks, including using a GUI, ADSI Scripts, or a command prompt.
GUI
The Active Directory Users and Computers application supplies a Graphical User Interface (GUI) that allows an administrator to create groups. The application is very easy to use and will probably be the most common way you will create groups.
Creating a New Group Using AD Users and Computers
To create a new group, follow these steps:
Right-click on the container name and choose New, Group. The New User dialog box appears.
Enter the following information into the appropriate fields:
When complete, click the OK button. The group will then be created in the directory.
Field |
Purpose |
Group name |
Defines the name of the group as it will appear in Active Directory. |
Group name (pre-Windows 2000) |
This field is automatically populated with data entered in the Group name field by default. However, if you want this group to appear differently in downlevel domains, you may specify a different name here. |
Group scope |
Group scope defines whether the group will be a Domain Local group, Global group, or Universal group. Universal groups are available only if the domain is operating in Native mode. See previous discussion for more information. |
Group type |
Group type determines whether the group will be a Security group or Distribution group. See previous discussion for more information on group types. |
Deleting a Group Using AD Users and Computers
Deleting a group object removes the pointer from the directory, but does not delete the member objects. Any rights or permissions assigned to a group are removed when the group is deleted. To delete a group, follow these steps:
Start the Active Directory Users and Computers application.
In the left-hand window, navigate to the container that holds the group you wish to delete.
In the right-hand window, right-click on the group name. Select Delete.
You will be asked, "Are you sure you wish to delete this group?"
Click Yes. The group will be deleted.
Modifying Group Membership Using AD Users and Computers
If you wish to change the group membership using the GUI interface, follow this process:
Start the Active Directory Users and Computers application.
In the left-hand window, navigate to the container that holds the group you wish to modify
In the right-hand window, double-click on the group name. The group properties dialog box will appear.
Select the Members tab. This will display the current membership of the group.
To add a user to the group, click the Add button. A dialog box will pop up, allowing you to select additional user(s) to add to the group.
To remove a user from the group, select the user you want to remove and click remove.
When finished, click on OK.
Command Prompt
As in Chapter 4.4, the command prompt utilities CSVDE and LDIFDE are the primary tools we have to make changes from the command line.
For more information on file formats and general usage of the utilities, see Chapter 4.4, "Creating and Managing User Accounts."
Creating Groups with CSVDE
To create a group with CSVDE, create a CSV input file with the following header contents:
On the next line, define the characteristics of the group. For example, the entry below creates a local security group named "LS". The following line should be entered as one entire line with no line breaks:
The first three header properties defined above are similar to the creation of user accounts in Chapter 4.4; however, the member and grouptype properties are new. As you might expect, these properties define the group membership (what objects are members of the group) and type of group (security, distribution, global, universal, etc.) you are creating.
Defining Group Membership
Group membership is specified by including the Distinguished Name (DN) of all objects you want to be members. Remember, because you are using CSVDE, you will not be able to modify membership later using this utility (you could use LDIFDE, though, among other methods). To define membership in the group, place the DN for each object in the "member" field. Separate multiple DNs with a semicolon. Don't forget to wrap the entire "member" field definition with quotation marks; otherwise, the commas in the DN will be confused as part of the CSV formatting.
Building on the prior example, if both testuser1 and testuser2 were to be added to the group, the following entry could be used:
Defining Group Type
As you know by now, there are several different kinds of groups. Specifying exactly which kind of group CSVDE should create can get a little tricky. The "grouptype" property is used to convey this information to CSVDE. This property expects a decimal number to be used to convey this information. As shown in the following table, the decimal values can be a little odd. To help clear up the confusion, look at the hex value column. You'll notice that the hex numbers aren't all that different. In fact, there's a pattern. This pattern will come in handy later when we show how to create groups using ADSI (Active Directory Service Interfaces). But for now, use the decimal values shown in Table 4.5.3.
Table 4.5.3 Hex and Decimal Values by Group Type
Group Type |
Hex Value |
Decimal value |
Global Distribution |
&H00000002 |
2 |
Global Security |
&H80000002 |
2147483650 |
Local Distribution |
&H00000004 |
4 |
Local Security |
&H80000004 |
2147483652 |
Universal Distribution |
&H00000008 |
8 |
Universal Security |
&H80000008 |
2147483656 |
Using LDIFDE to Manage Groups
Creating, modifying, and deleting groups can all be easily accomplished with LDIFDE. The following sections contain some brief examples of how to manage groups using this versatile command prompt utility.
Creating Groups
Creating groups with LDIFDE is similar to creating users, except for the additional member and grouptype properties. These properties were described previously in the CSVDE sections.
For more information on user creation, see Chapter 4.4, "Creating and Managing User Accounts."
After the LDIF file has been created, execute the LDIFDE command as follows:
The new group should now exist in the Users container (as defined in the IMPORT.LDF file).
Modifying Group Membership
In the following example, the membership list of a group is completely replaced with new membership information. To start, the following LDIF import file is created:
When this file is imported with LDIFDE, the membership of the group "test group" will be replaced with just one member: "test user1." Often, it is more desirable to simply add users to a group rather than replace the entire membership. For such cases, use the "add" change operation identifier instead of "replace." In the following example, we use "add" to preserve the current group membership and add an additional member. "Add" works only for multi-valued properties.
Deleting Groups
Deleting groups (or almost any object) is very easy with LDIFDEonly the Distinguished Name (dn) of the object needs to be specified. For example, to delete the group we created previously, create a file called DELETE.LDF with the following contents:
Next, execute the LDIFDE command as follows:
The group should now be removed from the directory.
ADSI Scripts
Built into Windows 2000, the Windows Script Host is an extremely useful tool for administration. Windows Script Host interprets a number of languages, including VBScript. The following examples contain some relatively simple ADSI procedure calls using VBScript code that can be run via the Scripting Host. With a rudimentary understanding of VBScript, the code can be easily customized for special needs.
If these code segments interest you, you should know that there is also a comprehensive set of ADSI-related scripts contained in the Windows 2000 Resource Kit. The Resource Kit scripts are more feature-rich than these skeleton examples that follow, but these scripts demonstrate well the basic functionality available through the Scripting Host. Each of the scripts may be executed by placing the code in a .VBS file, and using the Script Host to process the file.
Many of the scripts also contain specific directory references (jmulvey.com), which need to be changed slightly for your environment.
Creating an Empty Group with ADSI
The following code creates a new (empty) group using ADSI. After prompting the user for the name of the group, it creates the group in the Users container.
PartAdding Users to a Group with ADSI
The following script code prompts for a group name and then the user name to add to the group. Note that this code builds the DN of the user to add to the group programmatically, rather than asking the user for the full DN.
PartRemoving Users from a Group with ADSI
The following script prompts for a group name and then a user name. The script then removes the specified user from the group. Again, this script builds the DN programmatically, instead of expecting the user to accurately specify the full value.
PartDeleting a Group with ADSI
This code demonstrates how to delete a group using ADSI. It prompts for the name of the group, and assumes the group is in the Users container.
PartBest Practices for Managing Group Membership
To simplify administration, grant permissions to user groups, not directly to user accounts.
If membership in a Universal group changes frequently, place Global groups into the Universal group and make user changes in the Global group.