Solved

Exporting users from Groups

Posted on 2006-11-14
7
152 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:boomerbostock
ID: 18016373
sorry yes
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

734 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