SCRIPT: List Distribution Groups

by Bharat Suneja

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:
/s:y
– Option to get help:
/help
– Changed link to point to exchangepedia.com/blog

{ 16 comments… read them below or add one }

Anonymous March 19, 2007 at 12:33 pm

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?

Reply

Bharat Suneja March 19, 2007 at 3:46 pm

– 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”

Reply

Anonymous June 1, 2007 at 11:02 am

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

Reply

Bharat Suneja June 1, 2007 at 12:02 pm

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?

Reply

Bruce October 9, 2007 at 12:49 pm

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.

Reply

Meepster October 10, 2007 at 11:44 am

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

Reply

Anonymous October 23, 2007 at 9:08 am

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

Reply

Craig October 23, 2007 at 9:37 pm

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?

Cheers

Craig

Reply

syn3rgy November 8, 2007 at 9:36 am

Hi,

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.

Reply

Anonymous September 29, 2008 at 2:05 am

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

Reply

Anonymous April 8, 2009 at 4:01 am

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?

Thanks.
Dudie

Reply

Anonymous June 3, 2009 at 7:01 am

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

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

Reply

Anonymous October 25, 2009 at 9:37 pm

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 ?

Thanks

Reply

Anonymous November 3, 2009 at 8:51 pm

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

Reply

Anonymous March 10, 2010 at 9:57 am

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.

Reply

Anonymous June 2, 2014 at 11:57 pm

I too was getting the (null): 0x80005000 error. It was that I had users and/or distro lists with a forward slash in their names. But I had hard time finding them all. I added the following line to the script to make the script print what group it was looking at when the error happened. Then I could go look at the group and it’s members, find the forward slash and remove it. Then run the script again.

Obviously this counts as console output so do not use the /s:y option in this scenario.

Add a new line. This line should become Line 67, Col 13 (turn on the status bar in notepad to see this):
wscript.Echo VbCrlf & “Working on group: ” & strGroupDN

Reply

Leave a Comment

{ 1 trackback }

Previous post:

Next post: