VBScript get manager of an AD group

Posted on 2009-04-02
Last Modified: 2012-05-06
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 :-)
Question by:churchlandsshs
  • 2
LVL 65

Accepted Solution

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.


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


	MsgBox "There is no manager for " & Mid(objGroup.Name, 4)

End If

Open in new window


Author Closing Comment

ID: 31566064
Excellent as always
LVL 65

Expert Comment

ID: 24055934
No problem. Thanks for the grade.



Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 (…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Sending a Secure fax is easy with eFax Corporate ( First, just open a new email message. In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now