I have a script where I list all Group members from specific OU in my AD into an Excel sheet.
Each group should be listed in separate sheet.
The script is almost done, the only problem is that I cant get it to go to the next sheet and add the members there... It names the next sheets correct, but it list all members in the first sheet, overwriting the members that have already been added.
Heres is my code.
'On Error Resume Next
Dim objGroup, objExcel, objMember, iRow, icol, strUser, strList
Set objGroup = GetObject("LDAP:// ou=, ou=, ou=,dc=domain,dc=dom")
Set objExcel = CreateObject("Excel.Application")
.SheetsInNewWorkbook = 10
.Visible = True
icol = 1
For Each strList in objGroup
Set objMember = GetObject("LDAP://" & strList.Name & ", ou=, ou=, ou=,dc=domain,dc=dom")
.Worksheets.item(icol).Name = mid(strList.Name, instr(1,strList.Name,"=") + 1 )
icol=icol + 1
For Each strUser in objMember.Member
Set objUser = GetObject("LDAP://" & strUser)
.Cells(iRow,1) = objUser.CN
irow=irow + 1
Set objMember = Nothing
Set objExcel = Nothing
Set objGroup = Nothing
Thanks in advance.