Solved

VBScript get manager of an AD group

Posted on 2009-04-02
3
688 Views
Last Modified: 2012-05-06
Hi,
What is the easiest way to retrieve the manager of an AD group using VBScript. All I want to be displayed is the users Display name, not the fully qualified CN=...,OU=.... etc
Thanks :-)
0
Comment
Question by:churchlandsshs
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 24055901
Hi there, you can retrieved the ManagedBy attribute this way.

Remember that when you specify the path to the group object, to put it in reverse order.

Regards,

Rob.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set objGroup = GetObject("LDAP://CN=TestGroup1,OU=TestUsers,OU=TestOU," & strDNSDomain)
strManager = objGroup.Managedby
If strManager <> "" Then
	strManager = Mid(Split(strManager, ",")(0), 4)
	MsgBox strManager
Else
	MsgBox "There is no manager for " & Mid(objGroup.Name, 4)
End If

Open in new window

0
 

Author Closing Comment

by:churchlandsshs
ID: 31566064
Excellent as always
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 24055934
No problem. Thanks for the grade.

Regards,

Rob.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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