Copy Group Memberships the Easy Way


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.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.