Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exporting users from Groups

Posted on 2006-11-14
7
Medium Priority
?
160 Views
Last Modified: 2010-04-30
I have 25 distribution groups and over a period they have become nested with various users and groups. I would like to export to file the groups and there related users for checking and cleaning purposes.
Any ideas what i can use?
0
Comment
Question by:boomerbostock
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 18016274
I can do this with a bit of VB Script.  For each group member what information do you want to export?
0
 

Author Comment

by:boomerbostock
ID: 18016294
Firstly the users - Then the groups that have been nested in the DG and the users in those groups.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 18016367
Ok, but what information do you want?  Just names?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:boomerbostock
ID: 18016373
sorry yes
0
 
LVL 76

Accepted Solution

by:
David Lee earned 1500 total points
ID: 18016906
Try this.  It exports the members of the specified group to an Excel spreadsheet.  It drills down through any sub-groups to get all the members names.

Dim objGroup, objExcel, objSheet, iRow, objMemberPath, objMember
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
  Set objSheet = .Worksheets.Item(1)
  .Worksheets.Item(1).Name = mid(objGroup.Name, instr(1,objGroup.Name,"=") + 1 ) 'set Worksheet name to that of the DL
  irow=1

 For Each objMemberPath in objGroup.Members
    Set objMember = GetObject(objMemberPath.ADsPath)
    If objMember.Class = "group" Then
        ProcessGroup objMember
    Else
        objSheet.Cells(iRow,1) = objMember.displayName
        irow=irow + 1
    End If
 Next
 .Columns(1).entirecolumn.autofit
End With

objExcel.ActiveWorkbook.SaveAs "C:\eeTesting\Group Members.xls"
Set objSheet = Nothing
Set objExcel = Nothing
Set objGroup = Nothing  
Set objMember = Nothing
Set objMemberPath = Nothing
WScript.Quit


Sub ProcessGroup(objGroup)
    Dim objMemberPath, objMember
    For Each objMemberPath In objGroup.Members
        Set objMember = GetObject(objMemberPath.ADsPath)
        If objMember.Class = "group" Then
            ProcessGroup objMember
        Else
            objSheet.Cells(iRow,1) = objMember.displayName
            irow=irow + 1
        End If
    Next
    Set objMemberPath = Nothing
    Set objMember = Nothing
End Sub
0
 

Author Comment

by:boomerbostock
ID: 18016950
ok I'll try
procedure? copy to notpad and save as xxx.vbs Yes?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 18018088
Yes, that'll do it.
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question