Solved

Export all the Member in Distribution List in Exchange 2007

Posted on 2011-09-13
9
474 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

IoT Devices - Fast, Cheap or Secure…Pick Two

The IoT market is growing at a rapid pace and manufacturers are under pressure to quickly provide new products. Can you be sure that your devices do what they're supposed to do, while still being secure?

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
Suggested Courses

615 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