troubleshooting Question

vbscript help

Avatar of thepunish3r
thepunish3rFlag for Afghanistan asked on
Visual Basic Classic
22 Comments1 Solution1042 ViewsLast Modified:
I am new to vb and trying to use a script I found at here:


The script is this one and I am trying to export dl members, but I don't know what I need to enter in the script to get it working, right now I get a "DN Syntax error line 2 char 1"
This should give you what you're looking for...

Any help is appreciated, looking to get specific info on what fields need what and how to enter list that are like: #Test distribution list Two and in an OU under another, so like OU is Test and the OU that holds the dl is under test titled DL


Dim objGroup, objExcel, iRow, strUser
Set objGroup = GetObject("LDAP://CN=myDistList,ou=Messaging,dc=myDomain,dc=com")

Set objExcel = CreateObject("Excel.Application")
With objExcel
  .SheetsInNewWorkbook = 1
  .Workbooks.Add
  .Visible = True
  .Worksheets.Item(1).Name = mid(objGroup.Name, instr(1,objGroup.Name,"=") + 1 ) 'set Worksheet name to that of the DL
  irow=1

 For Each strUser in objGroup.Member
    Set objUser =  GetObject("LDAP://" & strUser)
    .Cells(iRow,1) = objUser.CN
    irow=irow + 1
 Next
 .Columns(1).entirecolumn.autofit
End With

Set objExcel = Nothing
Set objGroup = Nothing  
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 22 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 22 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros