Solved

Export all the Member in Distribution List in Exchange 2007

Posted on 2011-09-13
9
473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 
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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

734 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