Copy Group Memberships the Easy Way

If you want a quick and easy way to copy the memberships of distribution or security groups, check out CopyGroup.bat. This script copies memberships from one group to another group in Exchange Server 2003 and Exchange 2000 Server.

Readers

June 25, 2006

2 Min Read
ITPro Today logo


As an Exchange Server administrator in a large company, I've written a lot of scripts to make my job easier. One of those scripts, CopyGroup.bat, copies Active Directory (AD) group memberships from one group to another group in Exchange Server 2003 and Exchange 2000 Server. This script works with all types of distribution and security groups. Listing 1 contains an excerpt from CopyGroup.bat. You can download the entire script from the Exchange & Outlook Administrator Web site.

When I write a script, I always try to use standard components. That way, it will work even after a new service pack is installed. For this reason, the script uses the Dsquery, Dsget, and Dsmod utilities to find and copy group memberships. Windows Server 2003 includes these three tools. Alternatively, you can install them from the Windows Server 2003 Administration Tools Pack (adminpak.msi).

As callout A in Listing 1 shows, CopyGroup.bat uses an input file named utils.ini to obtain the name of the domain controller (DC) on which you want to copy group memberships. CopyGroup.bat and utils.ini must be in the same folder (e.g., C:admin). Figure 1, shows a sample utils.ini file, which must be customized. For example, you need to change DomainControllerName to the name of one of your DCs.

You need to run CopyGroup.bat as a domain administrator. To launch the script, use the syntax

copygroup.bat [FromGroup ToGroup]

where FromGroup specifies the group from which you're copying members and ToGroup specifies the group to which you're copying members. If you run the command without any parameters, you'll get a Help screen. Note that you must use the SAM account name for these groups. In addition, the group to which you're copying members (ToGroup) must not contain any existing members before running the script.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like