Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I want to know how many users there are in a specific group, for example P_Excel, in Active Directory. Is it posible to exclude all users beginning with "t_"? Where can I read more about this? Or, I would be thankful if someone can provide with examples. / Ulf |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ulf,
Ulf Nilsson wrote: I want to know how many users there are in a specific group, for example P_Excel, in Active Directory. Is it posible to exclude all users beginning with "t_"? Where can I read more about this? Or, I would be thankful if someone can provide with examples. If you do a google search on "ADSI" and "group" and "user", you should find some articles with more information. But here's a subroutine that will do what you're looking for: Sub EnumerateGroupInAD() Dim objAD As Object Dim objUser As Object Dim sDomain As String Dim sGroup As String Dim nNumUsers As Integer sDomain = "YourDomain" sGroup = "P_Excel" Set objAD = GetObject("WinNT://" & sDomain & _ "/" & sGroup) For Each objUser In objAD.Members If Left$(objUser.Name, 2) < "t_" Then nNumUsers = nNumUsers + 1 Debug.Print objUser.Name End If Next objUser Debug.Print vbLf & CStr(nNumUsers) & _ " total users in group " & sGroup & "." Set objAD = Nothing End Sub -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jake,
Thank you very much! / Ulf -----Original Message----- Hi Ulf, Ulf Nilsson wrote: I want to know how many users there are in a specific group, for example P_Excel, in Active Directory. Is it posible to exclude all users beginning with "t_"? Where can I read more about this? Or, I would be thankful if someone can provide with examples. If you do a google search on "ADSI" and "group" and "user", you should find some articles with more information. But here's a subroutine that will do what you're looking for: Sub EnumerateGroupInAD() Dim objAD As Object Dim objUser As Object Dim sDomain As String Dim sGroup As String Dim nNumUsers As Integer sDomain = "YourDomain" sGroup = "P_Excel" Set objAD = GetObject("WinNT://" & sDomain & _ "/" & sGroup) For Each objUser In objAD.Members If Left$(objUser.Name, 2) < "t_" Then nNumUsers = nNumUsers + 1 Debug.Print objUser.Name End If Next objUser Debug.Print vbLf & CStr(nNumUsers) & _ " total users in group " & sGroup & "." Set objAD = Nothing End Sub -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel and Active Directory | Excel Discussion (Misc queries) | |||
Data Connection - Active Directory | Excel Discussion (Misc queries) | |||
Login and logoff to active directory by VBA | Excel Discussion (Misc queries) | |||
Excel active directory | Setting up and Configuration of Excel | |||
How to get Active Directory Usergroup information | Excel Programming |