Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Active Directory

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Active Directory

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Active Directory

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel and Active Directory javagirl Excel Discussion (Misc queries) 2 March 30th 07 05:04 PM
Data Connection - Active Directory Rob Excel Discussion (Misc queries) 1 August 11th 06 06:56 PM
Login and logoff to active directory by VBA learn Excel Discussion (Misc queries) 0 March 23rd 06 09:29 AM
Excel active directory James Setting up and Configuration of Excel 0 April 6th 05 09:00 PM
How to get Active Directory Usergroup information Bert v.d. Brink Excel Programming 1 January 29th 04 03:24 PM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"