mikehollingsworth Posted December 7, 2011 Posted December 7, 2011 Hello All, Im try to create a list of members attached to a certain distribution list. Ive stumbled across a VBS script but cant get it to work, I wonder if anyone can see where I am going wrong? Dim objDistList, objExcel, ExcelRow, strUser, strDistListName, strOU strDistListName = InputBox("Enter the name of the Distribution List" _ & " who's members you wish to export.", "Distribution List Export") If len(trim(strDistListName)) = 0 Then Wscript.Quit End If Set objDistList = GetObject("LDAP://cn=" & strDistListName _ & ",ou=Distribution Lists,dc=hwood,dc=local") Set objExcel = CreateObject("Excel.Application") With objExcel .SheetsInNewWorkbook = 1 .Workbooks.Add .Visible = True .Worksheets.Item(1).Name = mid(objDistList.Name, _ instr(1,objDistList.Name,"=") + 1 ) ExcelRow=1 For Each strUser in objDistList.Member Set objUser = GetObject("LDAP://" & strUser) .Cells(ExcelRow,1) = objUser.CN .Cells(ExcelRow,2) = objUser.mail ExcelRow=ExcelRow + 1 Next .Columns(1).entirecolumn.autofit .Columns(2).entirecolumn.autofit End With Set objExcel = Nothing Set objDistList = Nothing Wscript.Quit The responce I get is: Windows Script Host --------------------------- Script: C:\Documents and Settings\hadmin\Desktop\exporter.vbs Line: 10 Char: 1 Error: There is no such object on the server. Code: 80072030 Source: (null) I hope someone can help? Cheers,
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now