Solved

Getting a group's members on Active Directory using NetGroupGetUsers

Posted on 2004-09-13
3
758 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 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

815 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now