Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Export all the Member in Distribution List in Exchange 2007

Posted on 2011-09-13
9
Medium Priority
?
479 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 2000 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Mailbox Corruption is a nightmare every Exchange DBA wishes he never has. Recovering from it can be super-hectic if not entirely futile. And though techniques like the New-MailboxRepairRequest cmdlet have been designed to help with fixing minor corr…
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

916 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