How to print distribution folder and list in exchange 2003 server?

90 pts.
Tags:
Distribution Lists
Exchange Distribution Groups
Exchange Server 2003
Is there a way to print a distribution list with the users included in exchange 2003 server? The company who I work want to clean up the distribution folder but they wanted printed out. Can someone help me please otherwise I need to do it manually.

Answer Wiki

Thanks. We'll let you know when a new response is added.

The following script will dump ALL groups to Excel, not just DLs.

<pre>
Const ADS_SCOPE_SUBTREE = 2
On Error Resume Next
‘——— WRITE TO EXCEL ————-
‘ Open spreadsheet.
Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()

objExcel.Cells(1, 1).Value = “Group ID”
objExcel.Cells(1, 2).Value = “Group Type”
objExcel.Cells(1, 3).Value = “Member ID”
objExcel.Cells(1, 4).Value = “Member Display Name”
objExcel.Cells(1, 5).Value = “Member Email Address”

‘—————————————
intRow = 2

‘——————————————-
‘ Set Global AD Connection Properties
‘——————————————-
Set objConnection = CreateObject(“ADODB.Connection”)
Set objCommand = CreateObject(“ADODB.Command”)
objConnection.Provider = “ADsDSOObject”
objConnection.Open “Active Directory Provider”
Set objCommand.ActiveConnection = objConnection
objCommand.Properties(“Page Size”) = 1000
objCommand.Properties(“Searchscope”) = ADS_SCOPE_SUBTREE

strDomain = InputBox(“Enter FQDN of the Active Directory Domain” &_
vbCRLF & VBCRLF & “Example: yourdomain.local”, “Enter Domain Name”)

StrSearchGroup = InputBox(“Enter Group(s) to search for:” & vbCRLF &_
vbCRLF & “You may use the * variable to search from multiple groups ‘e.g.DL-IT-*'”, “Group Mebership to Excel”)

strCommand = “SELECT distinguishedName,groupType,member,sAMAccountName,Name FROM ‘LDAP://” &_
strDomain & “‘ WHERE objectClass=’group’ AND sAMAccountName='” & StrSearchGroup & “‘”
WScript.Echo StrCommand
‘——————————————
objCommand.CommandText = strCommand
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst

Do Until objRecordSet.EOF
StrGroupDN = objRecordSet.Fields(“distinguishedName”).Value
Set objGroup = GetObject(“LDAP://” & strGroupDN)
objGroup.GetInfo
strWhenChanged = objGroup.whenChanged
strGroup = objGroup.sAMAccountName
Select Case objGroup.GroupType
Case 2
objExcel.Cells(intRow, 2) = “Global Distribution Group.”
Case 4
objExcel.Cells(intRow, 2) = “Domain Local Distribution Group.”
Case 8
objExcel.Cells(intRow, 2) = “Universal Distribution Group.”
Case -2147483646
objExcel.Cells(intRow, 2) = “Global Security Group.”
Case -2147483644
objExcel.Cells(intRow, 2) = “Domain Local Security Group.”
Case -2147483640
objExcel.Cells(intRow, 2) = “Universal Security Group.”
End Select

arrMemberOf = objGroup.GetEx(“member”)

For Each strMember in arrMemberOf
strMember = Replace(strMember, “/”, “\/”) ‘Check for DNs with this character
Set objUser = GetObject(“LDAP://” & strMember)

objExcel.Cells(intRow, 1) = strGroup
objExcel.Cells(intRow, 3) = objUser.sAMAccountName
objExcel.Cells(intRow, 4) = objUser.displayName
objExcel.Cells(intRow, 5) = objUser.mail
intRow = intRow + 1
Next

objRecordSet.MoveNext
Loop

WScript.Echo “Done”
</pre>

Hope it helps.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following