Solved

Export all the Member in Distribution List in Exchange 2007

Posted on 2011-09-13
9
470 Views
Last Modified: 2012-05-12
Hi All,

I would like to export all the user and groups under one distribution list in exhcnage 2007
example
All User is distribution list which have around 20 users names and 20 another Distribution list
i also want all the memeber in those 20 distribution list as well
kind of nested
can some one help me with this
if needed more explanation i am happy to give
at the moment i am using couple of code
get-distributiongroupmember - idnetity "group Name" | FT Name, Primarysmtpaddress
as an output give me all the user and dl list email address and name
but i want even all the user in those Distribution list as well  
0
Comment
Question by:jitendra_raychura
9 Comments
 
LVL 23

Expert Comment

by:Malli Boppe
ID: 36534048
save the script as .vbs run the  script and it should give you all groups and members.



Option Explicit



Dim objConnection, objCommand, objRecordSet, objGroup, objRootDSE,objFile, objFileSystem, objMember
Dim strLine

Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystem.OpenTextFile("Groups.xls", 2, True, 0)
objFile.WriteLine "Group Name" & VbTab & "Number of Members" & VbTab & "Members"


Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"

Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection

Set objRootDSE = GetObject("LDAP://RootDSE")
objCommand.CommandText = "SELECT name, aDSPath,mail " &_
      "FROM 'LDAP://" & objRootDSE.Get("defaultNamingContext") & "' WHERE objectClass='group'"
Set objRootDSE = Nothing

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 600
objCommand.Properties("Cache Results") = False

Set objRecordSet = objCommand.Execute

While Not objRecordSet.EOF
      Set objGroup = GetObject(objRecordSet.Fields("aDSPath"))
      
            strLine = objRecordSet.Fields("name") & VbTab
            
            strLine = strLine & objGroup.Members.Count & VbTab
            

            For Each objMember in objGroup.Members
                  strLine = strLine & objMember.Get("name") & ","
            Next

            If Right(strLine, 1) = "," Then
                  strLine = Left(strLine, Len(strLine) - 1)
            End If
            objFile.WriteLine strLine
      
      Set objGroup = Nothing
      objRecordSet.MoveNext
Wend

objConnection.Close
Set objRecordSet = Nothing
Set objCommand = Nothing
Set objConnection = Nothing

Set objFile = Nothing
Set objFileSystem = Nothing
0
 
LVL 49

Accepted Solution

by:
Akhater earned 500 total points
ID: 36534415
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 36534420
Much easier to use Quest commandlets for AD...


Get-QADGroupMember -Identity "ITServices" -Indirect | Export-CSV C:\data.csv

0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 37

Expert Comment

by:Neil Russell
ID: 36534424
0
 
LVL 49

Expert Comment

by:Akhater
ID: 36534441
Agreed Neilsr it is either but I just don't like them, I like to stay native. A personal preference I guess :)
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 36534503
Why stay native when you can do tasks in 1/10 of the time?

As I always say "We used to walk infront of cars waving red flags but now we go a little quicker"

Its called progress
0
 
LVL 49

Expert Comment

by:Akhater
ID: 36534597
well in your own environment you are king, I manage more than 100 customers and not 10% of these will allow the installation of custom add-ons so I prefer to have something native I script once and deploy at all
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 36534678
Bl***y customers!!!

I know what you mean. When I contracted I had it written into customer contracts that a set list of third party tools would be installed on ALL servers that we maintained or any and all SLA's were not achievable. Soon woke them up :D
0
 

Author Closing Comment

by:jitendra_raychura
ID: 36583877
Still Needs to export in XL with Their email address
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video discusses moving either the default database or any database to a new volume.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 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