• 1. London, UK
  • 2. New York, NY
  • 3. Sydney, Australia
  • 4. Melbourne, Australia
  • 5. Moscow, Russia
  • 6. Singapore
  • 7. Paris, France
  • 8. Chicago, IL
  • 9. Hong Kong
  • 10. Houston, TX

Monday, February 13, 2006


SCRIPT: List Distribution Groups

Posted by Bharat Suneja at 7:03 PM
I was able to modify this script I wrote a while back for general use.

What it does: Lists mail-enabled groups in a domain including following attributes:
- Group Name
- Group type (Security/Distribution group)
- Description (if the description field is populated)
- Manager
- Members

What needs to be added...
- If the group only receives from authorized senders (msExchRequireAuthToSendTo = TRUE)
- list of authorized senders - if "Only from" is selcted in Exchange Gneeral (authOrig)
- list of users who cannot send to this group - if "from Everyone except" is selected in Exchange General (unAuthOrig)

Download the zip file from here

Update 3/19/2007:
- Added option /f: to add output file path, creates output in a file:
ListDistGroups.vbs /f:"c:\MyOutputFile.csv"
- Option to suppress console output:
- Option to get help:
- Changed link to point to exchangepedia.com/blog

Labels: ,


March 19, 2007 12:33 PM
Anonymous Anonymous said...

it would be a useful script if every single new line didnt show up in a msgbox window. How do you send the output to a text file?

March 19, 2007 3:46 PM
Blogger Bharat said...

- If your default scripting engine is Wscript, it will behave that way. You can either use it as follows (invokes the Cscript engine which will output to the shell/command-line rather than in Windows boxes):
cscript ScriptName.vbs

..or you can change your computer's default scripting engine to Cscript:
Cscript //H:script //S

- Also note, the script was updated today, it now takes a file name/path as an option and produces output to file:
ScriptName.vbs /f:"C:\MyOutputFile.Csv"

June 1, 2007 11:02 AM
Anonymous Anonymous said...

Helo Bharat, I actually search a solution to list of authorized senders - if "Only from" is selected in Exchange General. Do you have any idea when your script will support this? thanx and congratulations. z0rmus

June 1, 2007 12:02 PM
Blogger Bharat Suneja said...

To anonymous poster above:
>>a solution to list of authorized senders - if "Only from" is selected in Exchange General.

For Distribution Groups only, or for all recipient types?

October 9, 2007 12:49 PM
Blogger Bruce said...

This script was working find and not it is stopping. What does this error mean?

listDistGroups.vbs(67, 13) (null): 0x80005000

I would appreciate any help on this.

October 10, 2007 11:44 AM
Blogger Veronica said...

I'm having the same issue as Bruce. Just a different line where my error is. Any suggestions?

October 23, 2007 9:08 AM
Anonymous Anonymous said...

I'm getting this same error:
listDistGroups.vbs(67, 13) (null): 0x80005000

October 23, 2007 9:37 PM
Blogger Craig said...

Great script, thanks for that. I've been trying to get a bit more of a specific result...list -display name, First name, Last name, primary email address- of each member in any/all OU's.

Can you help with that?



November 8, 2007 9:36 AM
Blogger Robert said...


Great script, thank you, only i am having a slight problem, i get the following error message after it has been running for a bit,

C:\listDistGroups.vbs(67, 13) (null): 0x80005000

It also does not output to a text file.

Any help would be greatly appreciated.

September 29, 2008 2:05 AM
Anonymous Anonymous said...

If you get the 0x80005000-error you probably have groups with a displayname containing a "/"

April 8, 2009 4:01 AM
Anonymous Anonymous said...

Hi Bharat, I'm running trhe script and it looks like it goes successfully, but it doesn't output the CSV file to the C drive.

Can you help?


June 3, 2009 7:01 AM
Anonymous Anonymous said...

To get an output file you need to run the script from the command line.

ListDistGroups.vbs /f:"c:\MyOutputFile.csv"

October 25, 2009 9:37 PM
Anonymous Anonymous said...

I've tried running it with the /f: filename and /s:y switches and it still comes up with a message box ...

Also, is there a way to list more than 2000 groups ?


November 3, 2009 8:51 PM
Anonymous Anonymous said...

I've tried running it with the /f: filename and /s:y switches and it still comes up with a message box. could you please help me to get the output in a file. thanks

March 10, 2010 9:57 AM
Anonymous Anonymous said...

This was awesome and very helpful to me. The output worked exactly as stated however, the suppression /s:y did not work--but that wasn't a big deal to me. Thank you very much for the post.


Post a Comment

Links to this post:

Create a Link

<< Home