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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor ( Top Charts is a view in which you can set seve…

726 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