Solved

Export all the Member in Distribution List in Exchange 2007

Posted on 2011-09-13
9
467 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
Comment Utility
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
Comment Utility
0
 
LVL 37

Expert Comment

by:Neil Russell
Comment Utility
Much easier to use Quest commandlets for AD...


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

0
 
LVL 37

Expert Comment

by:Neil Russell
Comment Utility
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 49

Expert Comment

by:Akhater
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Still Needs to export in XL with Their email address
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now