90 pts.
 How to print distribution folder and list in exchange 2003 server?
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.

Software/Hardware used:
ASKED: June 16, 2010  6:28 PM
UPDATED: June 16, 2010  7:43 PM

Answer Wiki:
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.
Last Wiki Answer Submitted:  June 16, 2010  7:43 pm  by  804TECH   95 pts.
All Answer Wiki Contributors:  804TECH   95 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _