[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 795
  • Last Modified:

Getting a group's members on Active Directory using NetGroupGetUsers

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
LucDesaulniers
Asked:
LucDesaulniers
  • 2
1 Solution
 
EDDYKTCommented:
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
 
LucDesaulniersAuthor Commented:
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
 
EDDYKTCommented:
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

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now