Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Getting a group's members on Active Directory using NetGroupGetUsers

Posted on 2004-09-13
3
Medium Priority
?
791 Views
Last Modified: 2008-01-09
Hey guys.

I have a program that extracts the members of a group using the NetGroupGetUsers function. It used to work fine until we migrated to Active Directory. The user that runs the function is set as domain administrator so I don't believe that there is a security issue here. The error code that is returned by the function is 2220 which means the the group isnt't found.

I have checked the name with the LAN and there is no spelling errors.

Any ideas?

Thanks.

Luc.
0
Comment
Question by:LucDesaulniers
  • 2
3 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12043995
Or just use this

'member in group
Dim grp As IADsGroup
Dim memberList As IADsMembers
Dim member As IADs

Set grp = GetObject("WinNT://yourdomainname/Administrators")
Set memberList = grp.members
For Each member In memberList
  Debug.Print member.Name & "(" & member.Class & ")"
Next
0
 

Author Comment

by:LucDesaulniers
ID: 12044093
What do I need to reference to make this work? I get a "user-defined type not defined" error on the IADsGroup type.

Thanks.
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 2000 total points
ID: 12044469
add Active DS Type library

activeds.tlb


if you don't have you can download from here

http://www.microsoft.com/ntserver/nts/downloads/other/ADSI25/default.asp

Or

just change to object

ie

Dim grp As object
Dim memberList As object
Dim member As object
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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

927 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