473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

AD Group Ownership

I am trying to use the following button code to allow a user to enter an
Active Directory account name and then have the system return the specified
user' group memberships and the "ManagedBy" value for each group membership.
Has anyone done this before? As it stands now it will just give back the
group memberships and no "ManagedBy" values. Thanks for all your helpl.
This code is from a button:
CheckedListBox3.Items.Clear()
Dim strDomain As String
Dim rootds As New DirectoryServices.DirectoryEntry("LDAP://rootDSE")
strDomain = rootds.Properties("DefaultNamingContext")(0)
Dim root As New System.DirectoryServices.DirectoryEntry("LDAP://" &_
strDomain)
Dim searcher As New System.DirectoryServices.DirectorySearcher(root)
Dim searchero As New System.DirectoryServices.DirectorySearcher(root)
searcher.Filter = "(&(objectCategory=user)(anr=" & TextBox3.Text & "))"
Dim results As System.DirectoryServices.SearchResultCollection
results = searcher.FindAll()
Dim result As System.DirectoryServices.SearchResult
For Each result In results
Dim User As New System.DirectoryServices.DirectoryEntry(result.Pat h)
Dim group As String
Dim count As Integer = 0
For Each group In (User.Properties("memberof"))
TextBox4.Text = TextBox4.Text & count & " / "
CheckedListBox3.Items.Add(User.Properties("membero f").Item(count))
searchero.Filter = "(&(objectCategory=group)(anr=" &_
User.Properties("memberof").Item(count) & "))"
Dim resulto As System.DirectoryServices.SearchResultCollection
resulto = searchero.FindAll()
Dim item As System.DirectoryServices.SearchResult
For Each item In resulto
Dim owner As New System.DirectoryServices.DirectoryEntry(item.Path)
'TextBox4.Text = TextBox4.Text & count & " / "
CheckedListBox3.Items.Add(owner.Properties.Values)
Next
count = count + 1
Next
User = Nothing
Next result

Nov 22 '05 #1
2 4152
>I am trying to use the following button code to allow a user to enter an
Active Directory account name and then have the system return the specified
user' group memberships and the "ManagedBy" value for each group membership.
Has anyone done this before? As it stands now it will just give back the
group memberships and no "ManagedBy" values.


You cannot do this in one step, unfortunately - you cannot query the
user's "memberOf" attribute and in the same search also "join in" the
group's "ManagedBy" attribute (like in a SQL Join).

What you can do (if you REALLY need this) is to enumerate the user's
"memberOf" property, and for each group found, bind to the group and
get it's "managedBy" property. Won't be very fast though! (lots of
costly bind operations).

Marc
Nov 22 '05 #2
>I am trying to use the following button code to allow a user to enter an
Active Directory account name and then have the system return the specified
user' group memberships and the "ManagedBy" value for each group membership.
Has anyone done this before? As it stands now it will just give back the
group memberships and no "ManagedBy" values.


You cannot do this in one step, unfortunately - you cannot query the
user's "memberOf" attribute and in the same search also "join in" the
group's "ManagedBy" attribute (like in a SQL Join).

What you can do (if you REALLY need this) is to enumerate the user's
"memberOf" property, and for each group found, bind to the group and
get it's "managedBy" property. Won't be very fast though! (lots of
costly bind operations).

Marc
Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Aienthiwan | last post by:
Ok - this one's a baffling one. I have a Python script run in cgi, it accesses a directory... /var/foo. The permissions on /var/foo are 770 with an ownership of mark:dbtest. The permissions...
1
by: Ryan | last post by:
We have a DTS package developed on our development PC's (SQL 7). It runs fine. When we schedule it on the server (SQL 7), it fails. We have been able to find that this is a known issue down to the...
4
by: tarmat | last post by:
I've been using code such as the following, whereby I call the constructor of a class with an object allocated on the heap. The class is responsible for tidying up the memory. class Base{};...
11
by: Jacob | last post by:
I am trying to find the best way of documenting (in code and comments) ownership of secondary contained objects. This is my current status, and I would appreciate feedback on it: Case 1: ...
1
by: Jason Steeves | last post by:
I am trying to use the following button code to allow a user to enter an Active Directory account name and then have the system return the specified user' group memberships and the "ManagedBy"...
14
by: Howard | last post by:
Hi, I recently had a problem where I decided to store objects in a vector. (Previously, I had always stored pointers in vectors). Well, naturally, when storing an object in a vector, using...
2
by: Benden Ziyade | last post by:
Hello; I want to write a C program that check file ownership in /bin directory(ls, mkdir...). But I don't know how I start. I'm happy with your helping.
9
by: Brian Hampson | last post by:
I am trying to determine all the groups which the current user has permissions to add a member. Here's my code: foreach (System.DirectoryServices.SearchResult ADSearchres in...
61
by: John.L.Henning | last post by:
The new CPU benchmark from the Standard Performance Evaluation Corporation is announced http://www.spec.org/cpu2006/ Readers of comp.arch and comp.benchmarks may recall that I posted a call...
1
by: Jatinder | last post by:
Can a group be made an owner of different db2 objects, like tables, views etc? if yes, then can I use trasnfer ownership to trsfer ownership to a group? Regards, Jatinder
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.