Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Get all group's members in a file to all the members email id's

Posted on 2007-07-23
Medium Priority
Last Modified: 2012-05-05

I have some mail groups in a txt file.Need to get there email id's of the members in it.

Question by:bsharath
  • 3
  • 3

Expert Comment

ID: 19553906
are these mail group from your own network....If yes what is the network architecture?
Is it windows domainand exchange based mail servre or what?
LVL 11

Author Comment

ID: 19553949
All are in the same network.

It is a exchanged based structure.
LVL 26

Expert Comment

by:Farhan Kazi
ID: 19554105
Are these groups visible in Active Directory?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 11

Author Comment

ID: 19554142
Yes they are visable...
LVL 26

Accepted Solution

Farhan Kazi earned 2000 total points
ID: 19554427
:: * This script require "Groups.txt" file on C: drive root from where it will pick group names
:: * Successful run will generate "GroupsReport.txt" file on C: drive root.
:: * Copy and paste following script in notepad and save it with any name having .cmd extension.
:: *** SCRIPT START ***

@Echo Off
SETLOCAL EnableDelayedExpansion

IF NOT EXIST C:\Groups.txt Goto ShowErr
FOR %%R IN (C:\Groups.txt) Do IF %%~zR EQU 0 Goto ShowErr
IF EXIST C:\GroupsReport.txt DEL /F /Q C:\GroupsReport.txt

FOR /F "delims=#" %%g IN ('Type C:\Groups.txt') Do (
      Echo Processing: %%g
      DSQuery Group -Name "%%g*" | DSGet Group -Members>C:\GMTmp.txt
      Echo ------------------------>>C:\GroupsReport.txt
      Echo Group: %%g >>C:\GroupsReport.txt
      Echo ------------------------>>C:\GroupsReport.txt
      FOR /F "delims=#" %%m IN ('Type C:\GMTmp.txt') Do (
          DSQuery * %%m -Attr mail -L >>C:\GroupsReport.txt
Goto EndScript
Echo "C:\Groups.txt" file does not exist or file is empty!
IF EXIST C:\GMTmp.txt DEL /F /Q C:\GMTmp.txt
:: *** SCRIPT END ***
LVL 11

Author Comment

ID: 19554603
Greate thanks this worked and reduced to take a report which other wise would have taken Hrs...

You should be titled.

Expert of the year,Sage,Savant and Wizard...
LVL 26

Expert Comment

by:Farhan Kazi
ID: 19554627
Thanks allot :)

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question